Comment by rendaw

Comment by rendaw 19 hours ago

3 replies

You choose all the colors in a color scheme, so why is this easier than just choosing a contrasting button text color in the first place? This is a feature to help teams so dysfunctional that individuals are free to choose an inconsistent background color yet at the same time aren't able to choose a contrasting foreground color?

What really needs a fix is when you have text over an image or other diverse background (like, sticky/fixed text over a scrolling background) and need to have it always visible. And... this doesn't help at all.

So not only does this only (maybe) help in very questionable circumstances, they needed to come up with an entirely new verb for it, it has an anemic feature set (only selects black or white), and they did it with the worst possible contrast selection algorithm (doesn't select the choice with the most perceptual contrast). Way to go!

healsdata 19 hours ago

Its limiting to dismiss a tool out of hand simply because you haven't encountered a situation where that tool would be useful.

Plenty of web sites allow the end-user to select colors[1], or automatically derive colors from assets provided by the end-user. For those that care about accessibility, they typically calculate contrasting colors to prevent the user from creating a non-accessible experience. A built-in CSS tool like this will, hopefully, encourage more sites to provide a basic amount of accessibility while in no way hindering those who want to build an even better experience.

It would be cool if this was more customizable like the npm contrast-color package but the blog post details why they started with white/black with intentions of changing the algorithm later.

[1] Example: https://coolors.co/8fbfe0-7c77b9-1d8a99-0bc9cd-14fff7

  • ctxc 5 hours ago

    Yep. A simple use case I had was letting users create "tags" and choose their own color for the chips (think Github PR tags like "good-first-issue" "bugs" but custom)

    I'm surprised parent hasn't come across this usage, I see it everywhere.

ezfe 19 hours ago

> and they did it with the worst possible contrast selection algorithm

They specifically say they are following WCAG 2 algorithms, and that WCAG 3 may correct this issue. They say that they can easily adjust to use the better algorithm in the future when it's standardized.