I'm trying to build a SCSS @each loop which calls a color from one map, and an opacity from another map.
I've found this can be done with variable lists, however can it be done with maps?
Example code:
$colors: (
red: red,
orange: orange,
yellow: yellow,
green: green,
);
$opacities: (
00: 0.0,
25: 0.25,
50: 0.5,
75: 0.75,
100: 1,
);
@each $color, $opacity in zip($colors, $opacities) {
.bg-#{$color}-#{$opacity} {
@include bg-color-op(#{$color}, #{$opacity});
}
}
@mixin bg-color-op($bg-color, $bg-opacity) {
background-color: rgba($bg-color, $bg-opacity);
}