I'm wondering if it's possible to create a mixin that can return a custom variable name.
For example, I have this mixin to return an rgba value.
.fadeColor(@color: #000; @opacity: 1) {
@returnColor: rgba(red(@color), green(@color), blue(@color), @opacity);
}
I can then do something simple like:
.class {
.fadeColor(#f00, .5);
color: @returnColor;
}
I will get my faded red text.
Ideally what I'd like to have the mixin do is take in a name that will be the return value so I can do something like:
.class {
.fadeColor(@myColor, #f00, .5);
color: @myColor;
.fadeColor(@myBG, #00f, .7);
background-color: @myBG;
}
Is this possible? Is there a different approach that I can take to get the same result?
I know that fade would be the most workable solution in this specific example, but in general, is creating a variable from a variable a thing that can be done in LESS.