Re: [csswg-drafts] [css-color] Clarification needed on how missing alpha components flow through relative color syntax for hsl/hwb (#10254)

The CSS Working Group just discussed `[css-color] Clarification needed on how missing alpha components flow through relative color syntax for hsl/hwb`, and agreed to the following:

* `RESOLVED: if 'none' is used in hsl and hwb, we serialize with slashes and none; and for rgb, we serialize with color function`

<details><summary>The full IRC log of that discussion</summary>
&lt;ChrisL> q+<br>
&lt;astearns> ack ChrisL<br>
&lt;dholbert> ChrisL: rgb and hsl serialize as legacy syntax, for compat/historical reasons<br>
&lt;weinig> q+<br>
&lt;dholbert> ChrisL: so they can't use the word 'none'<br>
&lt;dholbert> ChrisL: people have suggested that they serialize with modern syntax which does include 'none'<br>
&lt;astearns> ack weinig<br>
&lt;dholbert> ChrisL: let's resolve on that<br>
&lt;dholbert> weinig: in webkit we implement something a bit different<br>
&lt;dholbert> weinig: we serialize as hsl, and none is preserved, if you happen to use 'none'<br>
&lt;dholbert> weinig: so we pull legacy colors out of legacy prison if they happen to use 'none'<br>
&lt;TabAtkins> +1 to this<br>
&lt;dholbert> weinig: if you're using modern keywords, then they're not legacy colors anymore, so we're not bound by compatibility<br>
&lt;TabAtkins> that's def where i thought Chris was gonna go, i was surprised by the color() swerve<br>
&lt;dholbert> weinig: so if you use none in rgb, we should serialize them as-is<br>
&lt;romain> present-<br>
&lt;dholbert> ChrisL/ weinig : if we did conversion to srgb, all the nones would have to be resolved to 0<br>
&lt;dholbert> ChrisL: I like what weinig said better than my proposal<br>
&lt;dholbert> ChrisL: proposal is to serialize with modern syntax, with the slashes<br>
&lt;dholbert> emilio: I think it would be preferable to serialize with color() to avoid introducing a third format that authors need to deal with<br>
&lt;dholbert> ChrisL: the advantage is if you have a 'none' hue, then you can preserve that<br>
&lt;dholbert> ChrisL: whereas if you serialize to srgb, you have to convert it to 0<br>
&lt;dholbert> weinig: another reason this is straightforward: to make interpolation between hsl()'s work well... once you have 'none' in them, we internally keep them as hsl all the way through<br>
&lt;dholbert> so it doesn't affect the optimizations that engines have where hsls without none can be converted to 32-bit int<br>
&lt;dholbert> emilio: I guess the alternative would be to add a color-hsl() sort of thing...<br>
&lt;dholbert> ChrisL: I don't really like that<br>
&lt;dholbert> emilio: vs. legacy hsl... that might be more consistent?<br>
&lt;dholbert> ChrisL: it'd be modeled after hwb maybe<br>
&lt;dholbert> weinig: I don't think that's true; I think hwb follows the hsl pattern<br>
&lt;dholbert> weinig: we've been shipping this in webkit<br>
&lt;dholbert> emilio: I agree we need a new serialization either way. Either you convert to rgb, or... Also, for colors that do have the color() function, if you specify 'none' in rgb, we have to decide whether to serialize with slashes or not<br>
&lt;dholbert> ChrisL: my point from hwb is that it *only* uses slash syntax<br>
&lt;dholbert> emilio: but it only serializes as rgb, so engines convert it<br>
&lt;dholbert> emilio: my only concern with doing what's proposed is that there's a lot of parsing on the web that assumes rgb will serialize with commas<br>
&lt;dholbert> emilio: but on the other hand this scenario is an edge case and so pages probably wouldn't trip over this accidentally<br>
&lt;dholbert> emilio: but authors need to be prepared to parse a third syntax<br>
&lt;dholbert> emilio: this is a weak argument... I'm fine<br>
&lt;dholbert> weinig: authors have to handle a lot of other syntaxes as well, yeah<br>
&lt;dholbert> emilio: I'm fine with what weinig proposed<br>
&lt;dholbert> emilio: it's effectively the same as serializing with color and adding a color-hsl thing; it's about the same amount of work<br>
&lt;dholbert> emilio: it's weird that some colors cannot be specified with color(), but that ship has sailed<br>
&lt;dholbert> astearns: so hsl, rgb, and hwb colors... if 'none' is used, then we serialize the color as-specified?<br>
&lt;dholbert> ChrisL: we serialize using a modern syntax which does not yet exist, with hsl(...) with slashes and allows the word 'none'<br>
&lt;dholbert> emilio: the other weird thing is that for rgb, that would introduce 3 syntaxes when we can get away with 2<br>
&lt;dholbert> ChrisL: do we need it for rgb?<br>
&lt;dholbert> emilio: yeah, to preserve 'none'<br>
&lt;dholbert> emilio: in gecko, if you specify 'none' in alpha for rgb, we serialize with 0<br>
&lt;dholbert> and commas<br>
&lt;emilio> rgb(100 100 0 / none) -> color(srgb, ...)<br>
&lt;emilio> hsl(100 100 0 / none) -> hsl(100 100 0 / none)<br>
&lt;dholbert> emilio: so we should serialize like that^ ?<br>
&lt;dholbert> ChrisL: yes<br>
&lt;dholbert> emilio: I think that's fine<br>
&lt;ChrisL> and hsl(none 100 0) similarly preserves none<br>
&lt;dholbert> astearns: proposed resolution: if none is used, we serialize like that<br>
&lt;ChrisL> q+<br>
&lt;dholbert> emilio: does webkit do this?<br>
&lt;astearns> ack ChrisL<br>
&lt;dholbert> weinig: I'll check<br>
&lt;dholbert> ChrisL: authors can use this syntax too, right?<br>
&lt;dholbert> emilio: yeah<br>
&lt;dholbert> weinig: this round-trips, yeah. that's the most important property to preserve<br>
&lt;dholbert> PROPOSED: if 'none' is used in colors, we serialize with slashes and none<br>
&lt;dholbert> PROPOSED: if 'none' is used in hsl and hwb, we serialize with slashes and none; and for rgb, we serialize with color function<br>
&lt;TabAtkins> I don't know why we're doing this, but I don't care.<br>
&lt;dholbert> emilio: alternatively we could add color-hsl<br>
&lt;dholbert> weinig: but then color-oklab, etc<br>
&lt;emilio> s/color-hsl/color(hsl, ...)<br>
&lt;dholbert> RESOLVED: if 'none' is used in hsl and hwb, we serialize with slashes and none; and for rgb, we serialize with color function<br>
&lt;dholbert> weinig: this isn't specific to 'alpha', right?<br>
&lt;dholbert> ChrisL, emilio : right<br>
&lt;dholbert> astearns: done with morning session. lunch time<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10254#issuecomment-3807220858 using your GitHub account


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

Received on Tuesday, 27 January 2026 19:53:36 UTC