Re: [csswg-drafts] [css-color-5] Should colors nested in a parent color function (RCS, color-mix, light-dark, color-contrast) serialize in their most precision saving form (#10328)

(sorry for the lengthy delay in reply)

> > The serialization of a the declared value of a color used as the origin color inside of another color function (color-mix, RCS, color-contrast) is: [...]
> 
> I suggest _The serialization of a color function nested inside another color function, as components of a declared value, is: [...]_.
> 
> But is it actually needed to serialize this way in other color functions than relative colors? (and possibly `color-mix()`, #10414)
> 
> That is, is it needed to preserved unclamped channel values and unresolved color functions in `contrast-color()` and `light-dark()`?

My position is that if we could, we would want to preserve full precision in all cases, but due to historical content, we can't in a few places. So, in all new cases where, where historical content is not an issue, we should aim to be as precise as possible. 

> 
> [Parsing a `<color>` Value*](https://drafts.csswg.org/css-color-4/#parse-a-css-color-value) might need to be updated because it currently requires resolving `<color>` at parse time (ie. before serialization), which means `<percentage>` and `<angle>` are resolved to `<number>`, etc.

I am not sure I follow what the concern is here. That part of the spec requires fully resolving the color for use in things like canvas, so I am not sure where serialization would come in.

> > [...] followed by the canonical colorspace ("xyz-d65" for "xyz") [...]
> 
> I am not sure it is necessary: CSS Colors 4 says `xyz` is an alias of `xyz-d65` and [CSS Cascade 5](https://drafts.csswg.org/css-cascade-5/#value-aliasing) says that _legacy_ value aliases are converted _at parse time_...

Ok. I had it there just to resolve ambiguity, as using "xyz" would be shorter, and some implementations might want to argue that the "shortest serialization principle" should hold.

> Why not apply the shortest serialization principle and omit unitary alpha?

I intended the text "if an alpha component is present" to imply that, but I think you are right, more clarity there would be better.

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


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

Received on Monday, 2 September 2024 18:00:02 UTC