Re: [csswg-drafts] [css-color-5] Allow use of 0 with <percentage> color components (#7338)

@dbaron wrote:

> I think the query ended up not being right, since I think those "top 10 colors" are all valid today. I'm not sure exactly what the change that we'd want to consider is for `hsl()` and `hsla()`, though.

This issue does not mean to change `hsl()` and `hsla()`, _but_ they already got extended in CSS Color 5 to accept `<number>` values for their saturation and lightness values. The same applies to `hwb()` and its whiteness and blackness values.
So I thought it would be good to get some statistics on those as well because some values were invalid in CSS Color 4 but are valid in 5, e.g. `hsl(0 0 0)` or `hsla(200, 50%, 0.6, 0.8)`.

> Ah yeah, let me know if there are any special cases like numeric hues being valid.

Numeric hues were actually always valid for `hsl()` and `hsla()` since their introduction back in 2002. 😃 In addition to that, the hue can also be expressed as `<angle>` value, so e.g. `30deg` or `0.5turn` are valid and implemented by browsers already.

@rviscomi What has changed is that the second and third component of `hsl()`, `hsla()` and `hwb()` can now also be a number. Previously, they were just allowed to be percentages. That menas the check for those three functions needs to be more explicit.

For reference, see the [syntax of level 4 of the spec.](https://drafts.csswg.org/css-color-4/#funcdef-hsl) with [the one of level 5](https://drafts.csswg.org/css-color-5/#funcdef-hsl).

Sebastian

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


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

Received on Monday, 11 July 2022 20:27:39 UTC