I'm trying to get a setup going that will increment a class from 1 through 12 and set a background color based on a variable list (also of 12 variables).
I am close, but not getting what I'd hoped. This is my first foray into control directives in SASS, so please forgive my ignorance.
Currently, I'm getting the class incremented successfully. It's the part of choosing the incremented variable that I am missing out on.
@mixin colors {
$colors: $orange, $blue, $lightBlue, $teal, $lightTeal, $green, $lightGreen, $darkOrange, $orange, $lightOrange, $yellow, $lightYellow;
@each $color in $colors {
background-color:#{$color};
}
}
@for $i from 1 through 12 {
.block-#{$i} {
span {
@include colors;
}
}
}
This is outputting something like:
.block-10 span {
background-color: #faa21b;
background-color: #005ca8;
background-color: #0079c3;
background-color: #0088a8;
background-color: #009386;
background-color: #00a05e;
background-color: #589c45;
background-color: #d4772b;
background-color: #faa21b;
background-color: #f7971f;
background-color: #f9cc2a;
background-color: #f6ee32;
}
Ideally, I'd like to have one background-color declaration, not 12. I think this might be something simple I'm missing, though. Any insight would be appreciated!