Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://drafts.csswg.org/css-color-5/#contrast-color
contrast-color( <color> max )
The
max
keyword indicates that the most contrasting color should be returned. Either white or black.Omitting that keyword is allowed in the specification but it is purposefully left vague what the behavior should be in that case. This leaves room for browser engines to experiment with this.
I don't want to muddy the waters by providing a polyfill.
If our users want to use
contrast-color()
withoutmax
then they should get the real behavior so that they can also give feedback to browsers.Another reason not to implement this, is because I would like to tweak the outcome a bit depending on the matching
prefers-contrast
media query. That can only be done in a PostCSS plugin, not in the color parser package.This is tricky because there currently isn't anything better.
There are many candidates but there isn't consensus.
Things like APCA are really promising but we really cannot use that because of the attached license.
So for now we are stuck with WCAG 2.1