Przejdź do głównej zawartości

noHexColors

Ta treść nie jest jeszcze dostępna w Twoim języku.

biome.json
{
"linter": {
"rules": {
"nursery": {
"noHexColors": "error"
}
}
}
}

Disallow hex colors.

While hex colors are widely supported and compact, they can be less readable and have limitations in terms of color representation compared to color models like HSL or OKLCH. This rule encourages the use of more expressive color formats.

This rule is inspired by the Stylelint rule color-no-hex.

a { color: #000; }
code-block.css:1:12 lint/nursery/noHexColors ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected hex color.

> 1 │ a { color: #000; }
^^^^
2 │

Hex colors are less readable and have limitations compared to other color models.

Consider using a named color or a color function like rgb(), hsl() or oklch(). See MDN Web Docs on CSS color values for more information.

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 { color: #fff1aa; }
code-block.css:1:12 lint/nursery/noHexColors ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected hex color.

> 1 │ a { color: #fff1aa; }
^^^^^^^
2 │

Hex colors are less readable and have limitations compared to other color models.

Consider using a named color or a color function like rgb(), hsl() or oklch(). See MDN Web Docs on CSS color values for more information.

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 { color: #123456aa; }
code-block.css:1:12 lint/nursery/noHexColors ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected hex color.

> 1 │ a { color: #123456aa; }
^^^^^^^^^
2 │

Hex colors are less readable and have limitations compared to other color models.

Consider using a named color or a color function like rgb(), hsl() or oklch(). See MDN Web Docs on CSS color values for more information.

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 { color: black; }
a { color: rgb(0, 0, 0); }