<分区>
我在 Sass 中有一个带有键和值的映射
$colors: (blue: #0081d2, green: #288600, orange: #e57323);
@each $color, $value in $colors {
.#{$color} {
color: $value;
}
}
这有效并为我提供了具有适当值的 css 类名,例如:
.blue{
color: #0082d1;
}
想要的是一个根据映射中的键生成 sass 变量的函数。
$blue: #0082d1;
$green: #288600;
我一直在伤脑筋,但无法正常工作。