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

Add new contrast-color feature #2304

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Add new contrast-color feature #2304

wants to merge 5 commits into from

Conversation

captainbrosset
Copy link
Contributor

Don't look at the MDN page for this feature, it's outdated. See mdn/content#36904.

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Nov 21, 2024
@captainbrosset
Copy link
Contributor Author

I spent some time looking into CSSWG conversations and specs, but couldn't form a definitive point of view on what's needed here.
I think it makes sense to keep this feature, but remove the BCD key (since it got deleted anyway), and ship this as a way to hold the ID for a future feature.
Either that, or close the PR without merging, since I don't know how to describe this yet.

@ddbeck
Copy link
Collaborator

ddbeck commented Feb 6, 2025

@captainbrosset I'm trying to work this out in terms of whether or not we can be helpful developers. I think there are two plausible routes here: disambiguation or pretending it doesn't exist yet.

If we think this idea has enough attention that a lot of developers might have heard about it (from places that are not CSSWG issues), then main thing we can do at this point seems to be to provide disambiguation:

Looking around, it does appear that there have been articles on both color-contrast() and contrast-color() (example and example and example). The names here are super confusing—we can help with that.

In that scenario, it might make sense to create a discouraged color-contrast() feature (that looks a lot like <portal> from #2593) pointing to contrast-color(). They'd both be unimplemented, but at least it'd be sort of honest about the messy history and confusing names.

On the other hand, if we think that this is still obscure, flying under the radar, then let's close this PR and put it off until there's more developer interest.

@jamesnw
Copy link
Collaborator

jamesnw commented Feb 6, 2025

I could go either way, but given that color-contrast() appeared in the 2022 State of CSS Survey, I'm leaning towards recommending a discouraged color-contrast() feature that points to contrast-color(). There isn't a ton of chatter about the feature, but enough that disambiguation would be useful.

Although, to make the other case, early specs often go through bike shedding, and I'm not sure where to set the bar for disambiguating renamed features. Another instance would be inset-area getting renamed to position-area, after being present in several Chromium versions. We were able to avoid that question because it is part of the larger Anchor Positioning feature.

I think as long as we are okay with setting a precedent that may lead to more than just a handful of discouraged disambiguation keys, this one makes sense to disambiguate.

@captainbrosset
Copy link
Contributor Author

I could also go both ways.

The 2 smashing articles you found both talk about the old color-contrast function (rather than the soon-to-come contrast-color function). And out of them, only one really talks about the function itself. The other one just mentions it in passing.
That one article was likely written when safari was implementing behind a flag, as a way to get people excited about the bleeding edge.
So, yeah, not a lot of chatter apart from the usual bleeding edge blogs.

Which makes me think that there's value in publishing a discouraged feature for color-contrast, maybe. People might have learnt about it via these articles, and might be under the impression that it will soon be available.
But then again, we could also do nothing. The lack of a feature altogether, in our catalog, could be enough of a sign that color-contrast is not a feature worth learning about.

Is that last point true though? It makes a lot of sense to publish discouraged features for things that did exist for a while, and maybe don't anymore, or do but have better alternatives. At first sight, it seems to make less sense to do so for features that never saw the light of day. But, when a feature is born, we don't yet know whether it will see day light. As Chromium starts to create web-features for all new things as part of its shipping process, we will have a lot of features that are Chromium-only-behind-flag things. And these can either continue on, or get merged or renamed, or just plain stop.

So, I guess my conclusion is that I'm leaning towards creating a discouraged feature, just to put ourselves in the position of having done so while the work was happening in Safari, and later having to live with that ID being reserved, and that feature now being discouraged.

@captainbrosset
Copy link
Contributor Author

But, if we do create discourage color-contrast feature, then we also need to create a contrast-color feature to point to (via the alternatives field). But that feature doesn't exist yet anywhere, so we'd essentially be reserving the ID.

Copy link
Collaborator

@jamesnw jamesnw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good!

It is missing a dist file for contrast-color.
Edit: Nevermind, it's there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature definition Creating or defining new features or groups of features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants