color-hex-length
What it does
Section titled “What it does”Reports a hex color that can be written with three or four digits (#aabbcc). With the style option set to long, a color written short is reported instead.
Why it matters
Section titled “Why it matters”One length for hex colors keeps a file uniform, and the short form is the usual one: it is half the bytes and still unambiguous.
To fix, shorten each pair of equal digits to one.
Example
Section titled “Example”... width: calc(0px + 1px);... color: #aabbcc;...Configuration
Section titled “Configuration”css: lint: rules: color-hex-length: level: warn # off (default), warn, error options: style: "short"less: lint: rules: color-hex-length: level: warn # off (default), warn, error options: style: "short"scss: lint: rules: color-hex-length: level: warn # off (default), warn, error options: style: "short"| Option | Type | Default | Description |
|---|---|---|---|
style |
string | "short" |
short reports colors that can be shortened, long those that are short.Values: short, long |
Enabled by the presets: css/stylelint-standard.
Suppress one line with sudsy-disable-next-line color-hex-length 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-hex-length |
full |