【发布时间】:2014-12-10 22:58:12
【问题描述】:
我正在尝试为样式指南创建动态色样。我正在遍历我的 $colors-list 变量中的每种颜色,然后想打印出当前的十六进制值和变量名。
我希望它看起来像这样:
到目前为止,我可以看到十六进制值显示在开发工具中,但没有被打印出来。变量名称也显示十六进制值,并打印出所有这些值。我错过了什么吗?
$colors-list: (
$color-brand
$color-secondary
$color-accent
$color-base
$color-alert
$color-error
);
@each $current-color in $colors-list {
$i: index($colors-list, $current-color);
.color-#{$i} {
background-color: $current-color;
color: white;
float: left;
height: 100px;
margin: 5px;
position: relative;
width: 100px;
&:after {
content: “hex value is #{$current-color} var name is #{$colors-list, $i}”;
position: absolute;
top: 0;
left: 0;
z-index: 9999;
}
}
}
【问题讨论】:
标签: sass