function-color-channel
October 14, 2024 · View on GitHub
Encourage the use of the color.channel function over related deprecated color functions:
- color.alpha / alpha / opacity
- color.blackness / blackness
- color.blue / blue
- color.green / green
- color.hue / hue
- color.lightness / lightness
- color.red / red
- color.saturation / saturation
- color.whiteness
p {
opacity: opacity(rgb(210, 225, 221, 0.4));
/** ↑ ↑
* This function should be color.channel
*/
}
Options
true
The following patterns are considered violations:
@use "sass:color";
p {
opacity: color.alpha(rgb(210, 225, 221, 0.4));
opacity: alpha(#abcdef80);
opacity: opacity($my-color);
}
The following patterns are not considered violations:
p {
opacity: color.channel(rgb(210, 225, 221, 0.4), "alpha");
}