New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-color] Clarification needed on how missing alpha components flow through relative color syntax for hsl/hwb #10254
Comments
I think this is from 4.1. Processing Model for Relative Colors :
Aha! It is implied, but not directly stated, that alpha is analogous to alpha. |
If you agree, then I can add alpha to 12.2. Interpolating with Missing Components |
I'm not fully sure on that point. |
I totally agree that adding something to 12.2. Interpolating with Missing Components that says alpha is analogous to alpha would be great. To restate what is probably obvious though, the bigger issue on this one is should the conversion from HSL()/HWB() to color(srgb) done for serialization be a "normal conversion" or should it be a "conversion that carries forward analogous component missing values"? |
I thought a bit more about this and I think preserving the NaN (that is, using the "carries forward analogous component missing values" conversion) for alpha is better than not. My argument is there really isn't any value in converting it to 0 here. As much as possible, serialization tries to preserve as much information as possible, and since we can preserve this, why not. (It also seems to be what Chrome does). One things this does is beg the question, should all conversions between color spaces carry forward analogous missing components? In what cases would it not be what you want? |
Is there any part of the specification that indicates that you shouldn't always carry forward analogous missing components during conversions between color spaces? I thought this was always required. |
Section 4.4 is pretty explicit.
|
And since interpolation calls it out as a separate step, I think the implication is that if an algorithm wants carrying forward, it needs to call it out. |
Ah, indeed! The intention is to preserve missing components / So if there are algorithms where it isn't stated and where it could be preserved, then we should change that. The serialization as It doesn't currently state that carry forward should happen. But it also makes carry forward impossible for non-alpha components when the src and dest aren't both in srgb to begin with. |
https://codepen.io/romainmenke/pen/LYvvNrb This would also affect interpolation but there isn't any interop for |
In the WPT test,
css/css-color/parsing/color-computed-relative-color.html
, there are a few examples I don't quite understand and can't figure out which language in the spec dictate them.One is:
What allows the alpha value to be passed through as
none
?My understand here of the operations performed is:
rebeccapurple
converted to hsl() [hsl(270 50% 40%)
]hsl(none none none / none)
hsl(none none none / none)
is converted tocolor(srgb)
for serialization, resolving all missing components to 0 [color(srgb 0 0 0 / 0)
] (https://drafts.csswg.org/css-color-5/#serial-relative-color)Is the intention for that last conversion (from
hsl()
tocolor(srgb)
) to carry forward analogous component missing values?Somewhat perplexingly (and perhaps just an error in the test), the corresponding test
css/css-color/parsing/color-valid-relative-color
has a similar example.My expectation is that they should at least expect the same result.
Similarly, what would expect for missing components in the origin.
The text was updated successfully, but these errors were encountered: