Skip to content
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

Use 0 instead of none in OKLCH values #14741

Merged
merged 5 commits into from
Oct 21, 2024
Merged

Use 0 instead of none in OKLCH values #14741

merged 5 commits into from
Oct 21, 2024

Conversation

adamwathan
Copy link
Member

@adamwathan adamwathan commented Oct 21, 2024

This PR updates all of our OKCLH colors to use 0 instead of none due to weird behavior in Chrome where using color-mix with colors using none produces unexpected results:

image

Both none and 0 behave as expected in Safari and Firefox so suspecting this is a bug in Chrome rather than spec'd behavior.

Fixes #14740

@adamwathan adamwathan requested a review from a team as a code owner October 21, 2024 15:51
@thecrypticace
Copy link
Contributor

According to the spec Chrome is indeed wrong here (good bit of clipping because the text is lengthy):

… any missing components would be replaced with the value 0.
… classify any missing components in the input colors, … any analogous components … will be carried forward and re-inserted …
The analogous components are as follows: …
Hue H

Hue only ever corresponds to hue and nothing else. So chrome carrying none forward from hue in LCH to the blue channel in sRGB is definitely a bug.

@adamwathan
Copy link
Member Author

Also updated this PR to use in oklch for our color opacity modifier stuff, since that also resolves this issue and feels more correct now that we are using oklch for the default color palette.

I think including both changes makes sense regardless because we want to avoid that Chrome bug either way, and 0 is shorter than none too.

@adamwathan adamwathan merged commit 1c5bb39 into next Oct 21, 2024
1 check passed
@adamwathan adamwathan deleted the fix/oklch-none-to-0 branch October 21, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[v4.0.0-alpha.28] The neutral color doesn't work well with color-mix for transparency
2 participants