[csswg-drafts] [css-colors-5] Serialization of a relative color functions as component of specified values (#9464)

cdoublev has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-colors-5] Serialization of a relative color functions as component of specified values ==
I do not expect the following to apply in a specified value:

  > The serialization of the result of a relative color function is **the resolved value**.

https://drafts.csswg.org/css-color-5/#serial-relative-color

But the [WPT tests](https://github.com/web-platform-tests/wpt/blob/master/css/css-color/parsing/color-valid-relative-color.html) do. Perhaps the intention is actually to test resolved values (`getComputedStyle()`) instead of specified values (`getPropertyValue()`).

In these tests, relative sRGB functions serialize as resolved `color(srgb ...)` and other relative functions serialize as the corresponding resolved function: `lab(from <color> ...)` as `lab(...)`, `lch(from <color> ...)` as `lch(...)`, etc. `currentcolor` prevents resolving.

Math functions are resolved whereas they are preserved when serializing an "absolute" color functions.

[`color-mix()` serializes as is](https://drafts.csswg.org/css-color-5/#serial-color-mix):

  > The serialization of the specified value of a `color-mix()` function is the string `"color-mix(in "`, followed by [...]

So I am not sure what is the expected serialized value for eg. `rgb(from color-mix(...) ...)`.

If these tests are actually a work in progress, I suggest preserving the details of the value as specified by its author, and being consistent with the serialization of "absolute" color functions:

  1. map `<percentage>`, `<hue>`, `<alpha-value>`, to `<number>`, excluding in math functions, which are preserved
  2. clamp `<number>` when required
  3. normalize `<number>` representing a `<hue>` in `[0,360)`
  4. normalize `xyz` to `xyz-d65`

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9464 using your GitHub account


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

Received on Thursday, 12 October 2023 19:35:09 UTC