I try to darken a variable number of divs like that with following code:
To just go from one color to another, for say, a number of consecutive Notes @for $i from 0 through 11
&:nth-child(#{$i})
transform: rotate(#{30*$i}deg)
background-color: mix($gray1, $gray2, $i / 12 * 100% )
#{…}
inside the mix()
, because it's a sass function, so it's clear that any variables and computations used insides are to be resolved before turning it into CSS.#{…}
+/-1 issue
(like in every for-loop, in any language): going from 0/12 to 11/12