I am trying to create the following Less via a loop.
@brand-gold: #bd9e5e;
&.brand-gold {
background:@brand-gold;
}
&.brand-gold-20 {
background: tint(@brand-gold, 80%)
}
&.brand-gold-40 {
background: tint(@brand-gold, 60%)
}
&.brand-gold-60 {
background: tint(@brand-gold, 40%)
}
&.brand-gold-80 {
background: tint(@brand-gold, 20%)
}
I have a number of brand colours and would like to call a mixin/loop with the colour and have it print out the 5 classes.
Could someone help in this please?
Here is my code so far. I am having troubles creating the tint %.
@iterations: 5;
@brand-gold: #bd9e5e;
@brand-black: #231f20;
.brand-scale-loop (@i,@colour,@name) when (@i > 0) {
&.brand-@{name}-20 { background: tint(@colour, 80%); }
}
.brand-scale-loop(@iterations,@brand-gold,gold);
.brand-scale-loop(@iterations,@brand-black,black);