I try to do any less function which will be called to create some classes. Here is the way I tried :
.makeCssColor{@couleur) {
.coul_@{couleur} {
background-color: fade(~"@{couleur}, 'Fonce'", 15%);
&.open, &:hover {
background-color: ~"@{couleur}, 'Fonce'";
}
.btMod {
background : url('/img/btModEvt_@{couleur}.png') left top no-repeat transparent;
}
}
}
And I try to call it to create the classes :
.makeCssColor("bleu");
.makeCssColor("rouge");
But it generate an error. I don't find the good way to do it... And it bothers me to repeat all these code for each color (there is more than these line code and more thant two colors !). Can anyone give me a little help ? :)
[edit]
ok, thanks to your help, this code does not generate an error, but there is a mistake in the CSS file :
@marronFonce = #9d5a1e;
.makeCssColor(@couleur) {
.coul_@{couleur} {
.top {
background-color: @couleur, 'Fonce';
}
.mod {
background : url('/img/btModEvt_@{couleur}.png') left top no-repeat transparent;
}
}
}
.makeCssColor(marron);
Generate this into the css file :
.coul_marron .top{background-color:marron,'Fonce'}
.coul_marron background : url('/img/btModEvt_marron.png') left top no-repeat transparent;
So the background color isn't good :
.coul_marron .top{background-color:#9d5a1e}
.coul_marron background : url('/img/btModEvt_marron.png') left top no-repeat transparent;
I need to evaluate @couleur, 'Fonce' : @marronFonce => #9d5a1e. I tried @{@couleur, 'Fonce'} but it doesn't works...
@{couleur}be@couleuryou are not escaping that string. Also as far as I remember you don't need quotes for strings.makeCssColor(bleu)instead of.makeCssColor("bleu")