@color-purple: "#ffffff"
@colors: purple, light-purple, green, light-green, red, light-red, grey, light-grey, lightest-grey;
.ColorsMixin(@i:0) when(@i =< length(@colors)){ //loop over icons array
@color: extract(@colors, @i); //extract the icon at current index @i
.color--@{color}{
background: @{color-@{color}};
&:before{
content: "@{color}";
}
&:after{
content: "\@{color-@{color}}";
}
}
.ColorsMixin(@i + 1);
}
.ColorsMixin();
So, I can get it to do what I want to do in the
content: "\@{color-@{color}}";
part. This will output
content: "#ffffff";
However, when I try to output the @color-purple variable as the background, LESS throws an error. It only seems to work if I wrap it in quotation marks, but the background property wants the hex code without the quotes around it.
What's the trick here?