- From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
- Date: Tue, 28 Sep 2021 16:31:49 +0000
- To: public-css-archive@w3.org
Yeah, I think so. Just getting the WG's eyes on the solution would be good. So, in summary: "Missing" hues, and possibly saturations, can show up in transitions - going from white to yellow, for example. We have a special rule for this so it "does it right" by default, rather than defaulting achromatic colors to a particular starting hue like 0deg; instead it takes the hue from the other color. (This gives us a similar "right by default" behavior to the "transition in premultiplied sRGB" that we do by default, so transitions from `transparent` to any other color look good.) It seems useful to have this sort of transition behavior over colors explicitly, allowing one to do a transition that's "just hue" for example, leaving the chroma and lightness unchanged from the starting/ending color, or "just alpha" to fade a color in without having to know what the ending color is going to be. We *accidentally* already have ways to invoke "missing" behavior on all the channels of a color, via the `from <color>` syntax; coming "from" a gray in a cylindrical function, like `lch(from white, ...)`, makes the `h` variable undefined, which you can then use in any of the channels; missing-ness is then infectious (this might need slightly more precision to be well-defined; we've avoided it while discussing this issue). So a color that transitions "just alpha" with the opposing color could be spelled as `lch(from white, h h h / 50%)`. Since authors can already invoke this behavior in a weird hacky way, and we think the behavior is actually useful to invoke on purpose, we think there should be an idiomatic built-in way to invoke it. Our current thoughts are: * In CSS syntax, each color channel in all the color functions can accept a keyword, probably `missing` or `none`. * In Typed OM, it reflects as expected - the channel contains a CSSKeywordValue. * In Color API, the channel is set to either `null` or `NaN`; `null` is more idiomatic to the web platform, but `NaN` is more common among existing color APIs that address this exact issue, because it's "more infectious" than `null` (in many contexts `null` will convert to 0), and thus it's more likely that you'll realize your error if you didn't correctly handle the missing case. * While these are *intended* for use in animations, they can be displayed directly; in this case, the missing channels are filled in with an appropriate default per channel, generally `0` in the appropriate unit. -- GitHub Notification of comment by tabatkins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6107#issuecomment-929390142 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 28 September 2021 16:31:51 UTC