-
Notifications
You must be signed in to change notification settings - Fork 746
Description
In CSS Color 5, the serialization of relative colors is defined with the following:
The serialization of the declared value of a relative color function is a string identifying the color function in all-lowercase, followed by "(from ", followed by the serialization of the declared value of the origin color, followed by a single space, followed by a singly-space-separated list of the arguments to the color function, followed by ")".
(emphasis added)
If taken at face value, this would mean that relative colors do not round trip faithfully when the origin color has values outside the reference range, as the processing model for relative colors states:
When relative color syntax is used, color channel values, whether directly specified or arising from color space conversion, are not clamped to the reference ranges but are retained as-is. This preserves out of gamut values, if the destination color space is capable of representing them.
So, in an example like:
hsl(from hsl(127.9 302% 25.33%) h s l)
my reading is that the declared value would serialize as: hsl(from rgb(0, 255, 0) h s l)
, but the computed value would be color(srgb -0.511666 1.018266 -0.310225)
I would like to propose that nested colors, both for RCS and the other color functions that take color arguments, the nested colors serialize in a way that preserves the behavior of the parent. The most straightforward way I can think to have that work would be to serialize the declared value according to normal (not encumbered by the legacy of color serialization) CSS serialization rules for declared values - aka minimal needed, calc() preserving, etc.
In the case above, that would mean serializing the declared value exactly as written:
hsl(from hsl(127.9 302% 25.33%) h s l)
To expand with another example:
rgb(from hsl(calc(30 + 60) 50% none) r g b)
would serialize the declared value as:
rgb(from hsl(calc(90) 50% none) r g b)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status