mirror of
https://github.com/muerwre/muerwre.github.io.git
synced 2025-04-25 02:46:39 +07:00
470 B
470 B
Say, we need to color n
items by specific colors, which depend on its position. #SCSS supports iteration over lists for that purposes:
@mixin color-per-child($colors) {
@each $color in $colors {
&:nth-child(#{index(($colors), ($color))}) {
color: $color;
}
}
}
Usage is simple:
.item {
@include color_per_child((#ded187, #dbde87, #bade87, #9cde87, #87deaa));
}