I am creating a themeing system for a WordPress network that supports multiple layout themes that can support color schemes for a variety of universities. To do so, I periodically compile a LESS file (using lessphp) with school-specific variables and essentially use it as a library of helper classes in the themes.
Each school has 3 colors defined in LESS as: @primary
, @secondary
and @tertiary
. The method is straightforward and functional but requites a lot of repetition in the code. For example:
//Modifier Classes
.primary-lighter-text {
color: lighten(@primary,20);
}
.sec-lighter-text {
color: lighten(@secondary,20);
}
.tert-lighter-text {
color: lighten(@tertiary,20);
}
//Backgrounds
.primary-bg {
background-color: @primary;
}
.sec-bg {
background-color: @secondary;
}
.tert-bg {
background-color: @tertiary;
}
//Borders
.primary-border{
border-color: @primary;
}
.sec-border {
border-color: @secondary;
}
.tert-border {
border-color: @tertiary;
}
Nothing complicated from a LESS standpoint, but if I want to add a new helper class, I have to create 3. Is there a more succinct way to achieve this?