I'd like to define a global LESS variable depending on a class that is applied to the <body>
.
Is this possible with LESS?
Here is my mixin:
.dynamic-colors(@color) {
//set my variable
@c-dynamic: @color;
//I can use my variable here
.something {
color: @c-dynamic;
}
}
body.colors--black {
.dynamic-colors(#000000);
}
body.colors--red {
.dynamic-colors(#ff0000);
}
.something-else {
//this returns undefined because @c-dynamic
//was only defined inside of .dynamic-colors()
color: @c-dynamic;
}
I believe @c-dynamic
will be limited to the scope of the .dynamic-colors
mixin.
Is there any way I can set the variable to be global?