Skip to content

hexColorValidity

Reports hex colors with invalid values.

✅ This rule is included in the css logical presets.

CSS values for hex colors must have 3, 4, 6, or 8 digits or letters in a-f after the #. Values with other characters, or the wrong number of characters, are not valid hex colors.

This rule reports on values that start with a # but are not valid hex colors.

div {
color: #a1;
}
div {
color: #a1b2c;
}
div {
color: #ggg;
}

If you’re using a processor that works with seemingly invalid CSS colors, this rule might not be for you.

Made with ❤️‍🔥 around the world by the Flint team and contributors.