This question already has an answer here:
- Creating or referencing variables dynamically in Sass 5 answers
Let's say I have these colors:
$everlastingGreeN: #232553;
$vividRed: #3435454;
// and many more
//and define those:
$colors: (everlastingGreeN, vividRed);
How do I iterate those values so I can use the color name as the class name then the value as the background color?
@each $colors in $colors{
&.#{$colors} {
background: {color value};
&:hover {
background: darken({color value}, 10%);
}
}
}