$map: (
'1': rgb(99,226,226),
'2': rgb(114,149,230),
'3': rgb(249,202,109),
'4': rgb(249,172,109),
'5': rgb(159,242,106),
);
@each $key, $value in $map {
.legend-list .legend-item.style-#{$key} {
color: $value;
&:before {
background: rgba($value, 1);
box-shadow: 0 0 0 2px rgba($value, 0.3), 0 0 0 4px rgba($value, 0.15);
}
}
}
for的用法
$max: 10;
$unit: 4px;
@for $i from 1 through $max {
.pt-#{$i} {
padding-top: $unit * $i;
}
.pr-#{$i} {
padding-right: $unit * $i;
}
}