w3c / css-validator

W3C CSS Validation Service
https://jigsaw.w3.org/css-validator/
Other
204 stars 105 forks source link

Shorthand hexadecimal values are not recognized in custom properties #420

Open tylerjmorg opened 3 months ago

tylerjmorg commented 3 months ago

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.