【发布时间】:2018-09-23 08:56:20
【问题描述】:
我正在尝试在 scss 中单击更改对比度(将更改对比度类添加到正文)来更改颜色。
我的静态颜色是:
$primary-color-blue: #2aace2;
$mid-blue-color: #2695d2;
$dark-blue-color: #124b62;
关于改变对比:
$primary-color-blue: #177eab;
$mid-blue-color: #1c6f9b;
$dark-blue-color: #124b62;
应该类似于 sass
if(change-contrast) {
// console.log (get High Constrast Colors)
}
else {
// console.log (Static Colors)
}
我正在尝试像下面那样做,但如果我确实像下面那样,我必须添加到每个班级。
@mixin branding {
@each $brand in $brand_clr {
&.#{nth($brand,1)} {
$primary-color-blue: #177eab;
@content;
}
}
}
test {
background: $primary-color-blue;
@include branding {
background: $primary-color-blue;
}
}
感谢您对此的帮助!
谢谢
【问题讨论】:
标签: css if-statement sass scss-mixins