Skip to content

noScssDeprecatedColorFunctions (CSS)

Language CSS
biome.json
{
"linter": {
"rules": {
"nursery": {
"noScssDeprecatedColorFunctions": "error"
}
}
}
}

Disallow the deprecated Sass functions that read one channel of a color.

Sass has deprecated functions such as red(), color.hue() and opacity(), and plans to remove them. color.channel() replaces all of them. The rule also reports color.alpha(), which isn’t deprecated but fails for colors outside the rgb, hsl and hwb color spaces, and blackness(), which isn’t a Sass function.

The rule checks the values of properties and Sass variables. It doesn’t check the filter property, where opacity() is the CSS filter function.

@use "sass:color";
a {
opacity: color.alpha($brand);
}
code-block.scss:4:12 lint/nursery/noScssDeprecatedColorFunctions ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Use color.channel() instead of color.alpha().

3 │ a {
> 4 │ opacity: color.alpha($brand);
│ ^^^^^^^^^^^
5 │ }
6 │

ℹ This function fails for colors outside the rgb, hsl and hwb color spaces, such as colors made with oklch().

ℹ Replace it with color.channel($color, "alpha").

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

a {
opacity: opacity($brand);
}
code-block.scss:2:12 lint/nursery/noScssDeprecatedColorFunctions ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Use color.channel() instead of opacity().

1 │ a {
> 2 │ opacity: opacity($brand);
│ ^^^^^^^
3 │ }
4 │

ℹ Sass has deprecated this function and plans to remove it in a future version.

ℹ Replace it with color.channel($color, "alpha").

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

$hue: hue($brand);
code-block.scss:1:7 lint/nursery/noScssDeprecatedColorFunctions ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Use color.channel() instead of hue().

> 1 │ $hue: hue($brand);
│ ^^^
2 │

ℹ Sass has deprecated this function and plans to remove it in a future version.

ℹ Replace it with color.channel($color, "hue", $space: hsl).

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

@use "sass:color";
$hue: color.channel($brand, "hue", $space: hsl);
a {
opacity: color.channel($brand, "alpha");
filter: opacity(50%);
}