Re: [csswg-drafts] [css-color-4] Achromatic colors converted to hue-ish spaces should treat hue as "missing", not NaN (#6107)

Typed OM's representation seems straightforward - assuming we're using a keyword to represent a missing channel (`none` or `missing`), it'll just reflect as a CSSKeywordValue.  For the Color API, I presume it would expose as either NaN or null - I think `null` is more idiomatic for the web platform (we'd just type the attributes as `double?`), but it does break from the practice in several color libraries, as explored earlier in this thread.

> And can missing ever occur in (scriptless) CSS and how does it get represented there? Can I say lch(50, 1, missing) and if so what stops me saying lch(50, 100, missing) which is not a color?

We have to define the behavior of these cases anyway: you can today write ` lch(from gray 50 100 h)`, which has a missing hue. Such a color has reasonable transition behavior (it takes the hue from the other value); it just needs some definition for what it represents on its own (some sort of invalid color? a gray, ignoring its chroma? something else?).

Since authors *can* write such a color explicitly with these workarounds, letting them write it out directly seems reasonable, so yeah, we'd accept a keyword in place of each channel.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6107#issuecomment-912823481 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 3 September 2021 21:35:45 UTC