I'm looking for a less syntax to do something like that:
.button-default{
background-color: rgb(100,200,250);
:hover{
.button-hover-effect-mixin();
}
}
.button-warning{
background-color: rgb(250,100,0);
:hover{
.button-hover-effect-mixin();
}
}
.button-hover-effect-mixin(){
background-color: darken(PARENT.background-color, 50%);
}
I know how to do that with a parameter or a global variable but the hover-effect schould not always be designed to change the background-color.
If you mean the
.button-default
and.button-warning
are those "PARENT"s for the.button-hover-effect-mixin
then your friends are variables:You also can make this variable to be a parameter of
.button-hover-effect-mixin
. Additionally don't miss&
near:hover
selector (without&
it expands to.button-default :hover
and this probably is not what you need, see Nesting).And... if this goes in right direction and those colors are the only difference between the buttons I would rewrite the whole snippet to something like this: