-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Color 4] Various fixes #3858
[Color 4] Various fixes #3858
Conversation
Otherwise, you get weird behavior when conversion to the XYZ space preserves missing channels, which can cause colors to be considered `same()` even when they're visually distinct.
88995ea
to
2cde27c
Compare
color.same()
745f59f
to
0026eae
Compare
Now that `color.same()` explicitly treats missing channels as 0, it makes more sense for `==` to fill the stricter role and treat them as different. This is especially true because it already requires (non-legacy) colors to be in the same space, so missing channels are much more consistently meaningful than they would be in cross-space comparisons.
0026eae
to
ca967a4
Compare
c939218
to
97d6902
Compare
97d6902
to
c8fe2ed
Compare
@@ -2300,7 +2306,8 @@ ie-hex-str($color) | |||
|
|||
* If `$color` is not a color, throw an error. | |||
|
|||
* Let `rgb` be the result of [converting] and [gamut mapping] `$color` to `rgb`. | |||
* Let `rgb` be the result of [converting] and [gamut mapping] `$color` to `rgb` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: it feels a little odd that rgb
here stands for a variable and for a channel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's pretty common here to use the name of a color space to represent "the current color in that space". It is a bit odd but I think not so much that a reader can't get used to it, and it's substantially terser than using something like rgbColor
everywhere.
Zero missing channels before conversion in
color.same()
Otherwise, you get weird behavior when conversion to the XYZ space preserves missing channels, which can cause colors to be considered
same()
even when they're visually distinct.Treat missing channels as distinct from 0 for
==
Now that
color.same()
explicitly treats missing channels as 0, it makes more sense for==
to fill the stricter role and treat them as different. This is especially true because it already requires (non-legacy) colors to be in the same space, so missing channels are much more consistently meaningful than they would be in cross-space comparisons.Improve specifications for missing alpha values