Scss 通过改变颜色的饱和度值,让颜色更饱和,从而创建一个新的颜色

css yekong 812℃

saturate($color,$amount):通过改变颜色的饱和度值,让颜色更饱和,从而创建一个新的颜色

sass -i
>> saturate(#f36,50%) //把#f36颜色饱和度提高50%
#ff3366
//SCSS
$baseColor: #ad141e;
.saturate {
  background: saturate($baseColor,30%); //在原色饱和度基础上增加饱和度
}
.desaturate {
  background: desaturate($baseColor,30%);//在原色饱和度基础上减少饱和度
}

编译出来的 css 代码:

//CSS
.saturate {
  background: #c1000d;
}

.desaturate {
  background: #903137;
}
喜欢 (0)