color-no-invalid-hex
CSS / SCSS / LessCSS / SCSS / LessCSS / SCSS / Lesscorrectnessno fixdefault: warncss/stylelint-recommended
What it does
Section titled “What it does”Reports a hex color that does not have 3, 4, 6 or 8 digits (#ab).
Why it matters
Section titled “Why it matters”CSS accepts only those lengths, so the declaration is invalid and the browser drops it, and the element is left with the inherited or default color.
To fix, correct the number of digits.
Example
Section titled “Example”... border-color: #ab #abcde #abcdef;...Configuration
Section titled “Configuration”css: lint: rules: color-no-invalid-hex: warn # off, warn (default), errorless: lint: rules: color-no-invalid-hex: warn # off, warn (default), errorscss: lint: rules: color-no-invalid-hex: warn # off, warn (default), errorEnabled by the presets: css/stylelint-recommended.
Suppress one line with sudsy-disable-next-line color-no-invalid-hex 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-no-invalid-hex |
full |