Skip to main content

color-no-invalid-hex

禁止无效的十六进制颜色。

¥Disallow invalid hex colors.

a { color: #y3 }
/** ↑

* This hex color */

普通十六进制颜色可以是 6 个或 8 个(带 alpha 通道)十六进制字符。它们的简写形式分别是 3 个和 4 个字符。

¥Longhand hex colors can be either 6 or 8 (with alpha channel) hexadecimal characters. And their shorthand variants are 3 and 4 characters respectively.

message 次要选项 可以接受该规则的参数。

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

选项

¥Options

true

以下模式被视为问题:

¥The following patterns are considered problems:

a { color: #00; }
a { color: #fff1az; }
a { color: #12345aa; }

以下模式不被视为问题:

¥The following patterns are not considered problems:

a { color: #000; }
a { color: #000f; }
a { color: #fff1a0; }
a { color: #123450aa; }