color-function-alias-notation
What it does
Section titled “What it does”Reports rgba() and hsla(), the legacy names of rgb() and hsl(), on the function name.
Why it matters
Section titled “Why it matters”Since Color Level 4 rgb() and hsl() take an optional alpha value, so the a names are aliases that exist only for old code. Two names for one function make a stylesheet read as two styles.
To fix, write rgb(0 0 0 / 50%) instead of rgba(0 0 0 / 50%).
Example
Section titled “Example”a { color: rgba(0, 0, 0, 0.5); }...c { color: rgba(0 0 0 / 50%); }...e { color: hsl(120deg 50% 50%); }...g { color: hsla(120 50% 50% / 50%); }h { color: rgb(0 0 0 / 50%); }...j { color: rgb(var(--x), 0.5); }...m { color: oklch(50% 0.2 120deg / 50%); }n { color: rgb(0 0 0); }o { color: hsla(var(--h), var(--s), var(--l), 1); }Configuration
Section titled “Configuration”css: lint: rules: color-function-alias-notation: warn # off (default), warn, errorless: lint: rules: color-function-alias-notation: warn # off (default), warn, errorscss: lint: rules: color-function-alias-notation: warn # off (default), warn, errorEnabled by the presets: css/stylelint-standard.
Suppress one line with sudsy-disable-next-line color-function-alias-notation in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| stylelint | color-function-alias-notation |
full |