css - How to use variable variables in LESS with colors stored in named variables in loops and mixins? -
css - How to use variable variables in LESS with colors stored in named variables in loops and mixins? -
i have less loop in determine color values utilize in css rules. them through quite complex vars evaluation, forces me utilize strings (if remove " parse error). variable containing color value in form of string.
@color: "@{col_@{animal}}" // in loop, , @animal contains name of var ('dog', 'cat', ...) // @col_dog, @col_cat contain color // @col_dog: #f9e2a0 // @col_cat: #094dd0
so if seek assign @color variable rule
.border { border-color: @color }
in css get
.border {border-color: "#f9e2a0"}
which ignored. there way rid of "string" form, or way vars evaluation need without using strings?
thanks!
according docs http://lesscss.org/functions/#misc-functions-color
parses color, string representing color becomes color.
this should doing want:
.border { border-color: color(@color) }
css string less
Comments
Post a Comment