I want to be able to pick a SASS map item value by that map item's index.
Simplified scenario:
// Colors map (MUST stay this way due to system dependence)
$colors: (
a: red,
b: green,
c: blue
);
@for $i from 1 through 3{
a:nth-child({$i}){ color:[GET COLOR BY $i FROM $COLORS]; }
}
Is that possible?
gist demo
$colors: (
a: red,
b: green,
c: blue
);
@each $color, $name in $colors{
$i: index($colors, $color $name);
a:nth-child(#{$i}){ color:$color; }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With