Skip to main content

color-function-alias-notation

Specify alias notation for color-functions.

    a { color: rgb(0 0 0 / 0.2) }
/** ↑
* This notation */

Color functions rgb() and hsl() have aliases rgba() and hsla(). Those are exactly equivalent, and it's preferable to use the first variant without a.

The fix option can automatically fix all of the problems reported by this rule.

The message secondary option can accept the arguments of this rule.

Options

string: "without-alpha"|"with-alpha"

"without-alpha"

Applicable color-functions must always use the without alpha notation.

The following patterns are considered problems:

a { color: rgba(0 0 0) }
a { color: hsla(270 60% 50% / 15%) }

The following patterns are not considered problems:

a { color: rgb(0 0 0) }
a { color: hsl(270 60% 50% / 15%) }

"with-alpha"

Applicable color-functions must always use with alpha notation.

The following patterns are considered problems:

a { color: rgb(0 0 0) }
a { color: hsl(270 60% 50% / 15%) }

The following patterns are not considered problems:

a { color: rgba(0 0 0) }
a { color: hsla(270 60% 50% / 15%) }