Suppose you want to use multiple color schemes for different sections of a site. Static elements like header & navigation should use a variation of a given color (using less color functions).
Each section has the theme name attached as a class
on the body. So you could think of something like this:
body {
&.red {
@col: #f00;
}
&.blue {
@col: #00f;
}
background-color:darken(@col, 5%);
color:lighten(@col, 20%);
// & children
}
But @col
is not available outside of .red
or .blue
: NameError: variable @col is undefined
Is it possible to define a variable depending on a css selector? If not, what else could be done?
Edit: Sorry, this is a duplicate of Defining Variable Variables using LESS CSS