color-function-notation
What it does
Section titled “What it does”Reports rgb(), rgba(), hsl() or hsla() with the legacy comma-separated arguments (rgb(0, 0, 0)), also when one argument is a call such as var(). The space-separated form (rgb(0 0 0)) is not reported.
Why it matters
Section titled “Why it matters”The modern notation separates the channels with spaces and the alpha value with /, the way every other color function of Color Level 4 (lab(), oklch(), color()) does, so one rule of writing covers them all. The comma form is kept only for old browsers.
To fix, replace the commas with spaces and put / before the alpha value.
Example
Section titled “Example”a { color: rgba(0, 0, 0, 0.5); }b { color: rgb(0, 0, 0); }...e { color: hsl(120deg 50% 50%); }f { color: hsl(120, 50%, 50%); }...h { color: rgb(0 0 0 / 50%); }...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-notation: warn # off (default), warn, errorless: lint: rules: color-function-notation: warn # off (default), warn, errorscss: lint: rules: color-function-notation: warn # off (default), warn, errorEnabled by the presets: css/stylelint-standard.
Suppress one line with sudsy-disable-next-line color-function-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-notation |
full |