I was storing rgba values as variables (eg: @black: rgba(0, 0, 0, 1.0);
) and i realized it would be nice if i could make the alpha value variable.
So, i tried this..
.color_black (@alpha: 1.0) { rgba(0, 0, 0, @alpha) }
The problem is simply that this does not work. The parameter section seems to be right, infact it only seems to "break" once you add in the rgba() code. Less really doesn't like the rgba call.
Now i can make this work by defining the property tag, for example..
.color_black (@alpha: 1.0) { color: rgba(0, 0, 0, @alpha) }
But this sort of defeats the usefulness of storing a single color, and reusing it all over town. In backgrounds, texts, gradients, etc.
So, any thoughts on how to fix this?
edit: While i am not happy with this either.. this is the best solution i can come up with..
.color_black (@prop: color, @alpha: 1.0) { @prop: rgba(0, 0, 0, @alpha) }
It's not as useful of a function, as you can't use it in other properties (gradients, etc). Thoughts?