Does LESScss convert all rgba colors to hex values?
I am trying to create a mixin, say, .color, that allows you to pass in a color variable previously defined, and I want it to be in rgba.
this doesn't work, but here's the idea:
.bgcolor(@colorvariable,@alpha) {
background-color: @colorvariable + rgba(0, 0, 0, @alpha);
}
Where @colorvariable
would be, @blue: rgb(17,55,76);
or @green: rgb(125,188,83);
etc.
I want to define a bunch of these variables, and then be able to pass them in to .bgcolor
or .color
mixin and change the alpha transparency on the fly.
I feel like this should be possible, but I am missing something. -Right now, my code only ever outputs a hex color value, almost no matter what I input.- If I pass in an @alpha value of 1, it outputs a hex color value. Only @alpha values less than 1 force the browser to show me an rgba value. So that's solved.
Now--how to pass in the rgb and a parts separately from a predefined variable?
LESS has a set of functions to
fade
,fadeIn
, orfadeOut
a color. You should be able to pass any color to these mixins (hsl, rgb, rgba, hex, etc.)