.colors(@mixin) {
@helpercolorname: extract(@pp-module-variations, 1);
.color-looper(
1;
@colorname: @helpercolorname;
@colorvalue: ~"@{pp-@{helpercolorname}-color}"
) ;
.color-looper(@i;@colorname;@colorvalue) {
@length: length(@pp-module-variations);
@last: `( @{i} == @{length} )` ;
& when (@last = false) {
@colorname-intern: extract(@pp-module-variations, @i + 1) ;
@colorvalue-intern: ~"@{pp-@{colorname-intern}-color}";
@mixin();
.color-looper(@i + 1 ;@colorname:@colorname-intern;@colorvalue:@colorvalue-intern) ;
}
& when (@last = true) {
@mixin();
}
}
}
this is my loop for now
works properly.
i definded some colors like this
@pp-default-color: #22A7F0;
and added them to
@pp-module-variations: ~"default", some, other, colors;
this successfully loops trough all the colors on this mixin, and also passes the name and the value to it.
.colors({
.some-class-with-@{colorname} {
color: @colorvalue;
}
})