Skip to content

Commit 99104cd

Browse files
svgeesusclaude
andcommitted
[css-color-5] Preserve hsl/hwb identity when result contains none, #10254
Per CSSWG resolution 2026-01-27, defer to the css-color-4 sRGB serialization rules: an hsl() or hwb() color-mix or relative-color result that contains a missing component (including an alpha carried forward from the origin color) serializes using the modern hsl(H S L / A) or hwb(H W B / A) form, rather than degrading to color(srgb r g b) which would lose the original color-function identity. Adds a worked example for the original test case "hsl(from rebeccapurple none none none / none)". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ec017b3 commit 99104cd

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

css-color-5/Overview.bs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3325,6 +3325,16 @@ depends on the color space specified with "in":
33253325

33263326
</dl>
33273327

3328+
However, if the result of mixing in the ''hsl'' or ''hwb'' [=color space=]
3329+
has at least one [=missing color component=]
3330+
(including a [=missing=] alpha [=carried forward=]
3331+
per [[css-color-4#interpolation-missing]]),
3332+
the form used is the modern ''hsl(h s l / a)'' or ''hwb(h w b / a)'' syntax respectively,
3333+
preserving the original color function and each ''none'' value
3334+
per [[css-color-4#css-serialization-of-srgb]],
3335+
rather than degrading to ''color(srgb r g b)'' (which would lose
3336+
the ''hsl''/''hwb'' identity).
3337+
33283338
<wpt>
33293339
parsing/color-valid-color-mix-function.html
33303340
color-mix-currentcolor-visited-getcomputedstyle.html
@@ -3508,6 +3518,23 @@ while the serialization of the computed value
35083518
is the string "color(srgb 0.55 0.45 0.45)".
35093519
</div>
35103520

3521+
<div class="example" id="ex-serial-rcs-alpha-none">
3522+
For example, the serialization of the declared value of
3523+
3524+
<pre class="lang-css">hsl(from rebeccapurple none none none / none);</pre>
3525+
3526+
is the string "hsl(from rebeccapurple none none none / none)".
3527+
3528+
The computed value carries forward the [=missing=] alpha
3529+
(alpha is its own [=analogous components|analogous component=]),
3530+
giving an ''hsl()'' [=relative color=]
3531+
whose hue, saturation, lightness, and alpha are all [=missing=].
3532+
Because the resolved value contains [=missing color components=],
3533+
the serialization uses the modern ''hsl()'' form,
3534+
yielding the string "hsl(none none none / none)"
3535+
rather than ''color(srgb 0 0 0 / none)''.
3536+
</div>
3537+
35113538
<div class="example" id="ex-serial-rcs-hsl-unclamped">
35123539
For example, the serialization of the declared value of
35133540

@@ -3616,6 +3643,19 @@ depends on the color space of the [=relative color=]:
36163643
</tr>
36173644
</table>
36183645

3646+
However, if the resolved value of an ''hsl()'' or ''hwb()'' [=relative color=]
3647+
has at least one [=missing color component=]
3648+
(including a [=missing=] alpha [=carried forward=]
3649+
from the [=origin color=] per [[css-color-4#interpolation-missing]]),
3650+
the form used is the modern ''hsl(h s l / a)'' or ''hwb(h w b / a)'' syntax respectively,
3651+
preserving the original color function and each ''none'' value,
3652+
rather than degrading to ''color(srgb r g b)'' (which would lose
3653+
the ''hsl''/''hwb'' identity).
3654+
This parallels [[#serial-origin-color]],
3655+
which always emits the modern slash syntax for origin colors,
3656+
and follows the general sRGB serialization rules in
3657+
[[css-color-4#css-serialization-of-srgb]].
3658+
36193659
<wpt>
36203660

36213661
</wpt>

0 commit comments

Comments
 (0)