css-validator
css-validator copied to clipboard
Shorthand hexadecimal values are not recognized in custom properties
It looks like the validator does not recognize shorthand hexadecimal colors (e.g., #000) in the CSS validator when inside a custom variable.
Consider the following example:
CSS:
:root { --primary-color: light-dark(#000,#fff); } ... body { color: var(--primary-color); }
The validator displays the following:
Value Error : color [#000] is not a [color] value : [var(--primary-color)]
Although, it looks like shorthand hexadecimals are used as an example in the W3C standard.
Standard (CR): https://www.w3.org/TR/css-variables-1/ Standard (Editor's Draft): https://drafts.csswg.org/css-variables/
You can also test the examples on with https://tylermorgan.co/ in the validator.