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

Remove css.types.color.color-contrast #25305

Merged
merged 3 commits into from
Dec 10, 2024
Merged

Remove css.types.color.color-contrast #25305

merged 3 commits into from
Dec 10, 2024

Conversation

jamesnw
Copy link
Contributor

@jamesnw jamesnw commented Dec 3, 2024

Summary

The color-contrast() CSS function is no longer part of CSS Color Module Level 6. It was renamed to contrast-color(), and the spec has changed since Safari and Chrome did their experimental implementations.

There's a few layers to this decision (renaming an experimental feature and changing the functionality), but my thought is that the cleanest would be to view color-contrast() and contrast-color() as separate types, meaning:

  • Set color-contrast to standard_track: false
  • Remove the color-contrast spec link (it links to the spec for constrast-color)
  • Create contrast-color once there is implementation.

I'm open to other ideas as well.

@github-actions github-actions bot added data:css Compat data for CSS features. https://developer.mozilla.org/docs/Web/CSS size:xs [PR only] 0-6 LoC changed labels Dec 3, 2024
@caugner
Copy link
Contributor

caugner commented Dec 4, 2024

and the spec has changed since Safari and Chrome did their experimental implementations

Can you elaborate on the spec changes? Is there a particular spec PR? If the changes are small, then I could imagine that it makes sense to track it as a partial implementation with an alternative name.

@jamesnw
Copy link
Contributor Author

jamesnw commented Dec 4, 2024

and the spec has changed since Safari and Chrome did their experimental implementations

Can you elaborate on the spec changes? Is there a particular spec PR? If the changes are small, then I could imagine that it makes sense to track it as a partial implementation with an alternative name.

Digging a bit deeper has made it less clear- apologies. Essentially, the current implementation with color-contrast is not to any current spec, and there are 2 future levels of contrast-color.

Spec changes

In Level 5, the function takes a single color and an optional keyword max.

In Level 6, the function takes a color, an optional list of candidate colors, an optional yet-to-be-determined keyword for foreground or background, and an optional contrast algorithm.

There is a resolution on this issue to include an MVP in Level 5, and then full functionality in Level 6. There is an issue to add Level 5 syntax to Level 6 syntax.

Current implementation

I incorrectly thought there was Chrome implementation. The Safari implementation uses a color-contrast([base] vs [list]) syntax that is not in either level.

Given this, what makes the most sense for this key?

@caugner
Copy link
Contributor

caugner commented Dec 6, 2024

I incorrectly thought there was Chrome implementation. The Safari implementation uses a color-contrast([base] vs [list]) syntax that is not in either level.

Given this, what makes the most sense for this key?

Based on this, it would make sense to me to remove the color-contrast BCD feature altogether, as the old standard for it was effectively not implemented by any browser.

Requesting a second opinion from @Elchi3.

@Elchi3
Copy link
Member

Elchi3 commented Dec 9, 2024

I agree with @caugner let's remove it altogether since it is essentially "spec-fiction" and not real.

@jamesnw jamesnw changed the title Remove spec from color-contrast, mark as non-standard track Remove css.types.color.color-contrast Dec 9, 2024
@github-actions github-actions bot added size:m [PR only] 25-100 LoC changed and removed size:xs [PR only] 0-6 LoC changed labels Dec 9, 2024
@jamesnw
Copy link
Contributor Author

jamesnw commented Dec 9, 2024

Sounds good to me. @caugner I've removed color-contrast on this branch.

@Elchi3 Elchi3 merged commit a41046f into mdn:main Dec 10, 2024
9 checks passed
@mdn-bot mdn-bot mentioned this pull request Dec 10, 2024
@jamesnw jamesnw deleted the color-contrast branch December 16, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:css Compat data for CSS features. https://developer.mozilla.org/docs/Web/CSS size:m [PR only] 25-100 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants