1
有什么方法可以使用hsl
仅调整特定值?例如,如果我只想改变饱和度或亮度并保持色调一致?CSS:如何仅使用hsl颜色更改一个值
.red {
background-color: #ff0000; /* or, hsl(0,100%,50%); */
}
.red-dark { // Adjust saturation +10% and lightness -15%
background-color: hsl(, +10%, -15%);
}
一般来说,按照它们的颜色命名类而不是它们的预期用途是不好的做法。不过,我认为你所寻找的是类似SASS的东西,它可以让你分配变量供使用,而且似乎有一些函数可以帮助你。类似于这个SO帖子中显示的那样►http://stackoverflow.com/questions/1625681/dynamically-change-color-to-lighter-or-darker-by-percentage-css-javascript – Nope