Say I have three separate color schemes that are used on various pages in a site. Each color has a a light, medium and dark tint defined, and the color scheme is defined by
If those values really follow a predictable format like that, seems like a perfect case for a parametric mixin:
Less:
@red: #232;
@green: #565;
@blue: #898;
.theme (@color) {
background-color: @color - #111;
#container {
background-color: @color;
p { color: @color + #111; }
}
}
body.red {
.theme(@red);
}
Compiled CSS:
body.red{background-color:#112211;}
body.red #container{background-color:#223322;}
body.red #container p{color:#334433;}