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-5] unclamped alpha through RCS #9805
Comments
@LeaVerou I am still of the opinion that unclamped alpha in RCS is an unexpected and unwanted side effect of unclamped color components. And unlike those, where unclamped color components serves a useful purpose (prevents cumulative premature gamut clamping and thus hue drift etc) unclamped alpha is surprising and only noticeable in contrived test cases like setting alpha to 127 and then RCS uses alpha as the green channel to get a nice testable "green pass". What do you think? |
So it seems that lots of good things come from clamping alpha. What are the arguments against clamping? |
None, it happened by accident |
Did it actually happen? I thought this was mainly something that wasn't fully explored and was maybe lacking some WPT tests. As far as I can tell both Safari and Chrome clamp alpha. So could be as simple as adding an extra test and closing this? :) |
Color 4 says that for
and for Lab, LH and friends it says
and does not specify any clamping for So RCS, which is currently silent about clamping, needs to say that there is no clamping of color components. And that there is clamping of And yes, WPT tests would be great once there is a testable assertion in the spec that they can point to. |
How does that look? Edit: Now live in the spec |
Thank you for the speedy edits @svgeesus, Text is clear to me. |
see : #9759 (comment)
@svgeesus said :
I kept coming back to this.
I initially concluded that this behavior isn't useful.
But I wanted to have a better understanding of the implication of either mode.
I think there are 2 cases where an unclamped alpha could be observable:
I might be wrong here
https://codepen.io/romainmenke/pen/dyrvGoz
calc expressions in RCS
If the value is clamped then the result must be
0.5
, if it is unclamped it must be1
.interpolation
If the value is clamped then the result must be
rgba(151, 104, 104, 0.55)
, if it is unclamped then it must bergb(253, 2, 2)
.Other channels are also affected because premultiplying by alpha will have very different results.
Compared to other channels which aren't clamped:
https://codepen.io/romainmenke/pen/OJqpMgr
Best viewed in Chrome as that implementation is more up to date
I do think that it is observable that alpha is clamped or not in RCS but I still don't think it enables authors to do something useful.
While clamping will almost always produce the results you would intuitively expect.
There also seems to be interop for clamping alpha in RCS.
@svgeesus thoughts?
The text was updated successfully, but these errors were encountered: