w3c / apa

APA WG deliverables have been moved to individual repositories
Other
47 stars 38 forks source link

Propose a clamp option for CSS contrast-color() #345

Open ghurlbot opened 6 months ago

ghurlbot commented 6 months ago

Opened by matatk via IRC channel #apa on irc.w3.org

Due: 2024-04-03 (Wednesday 3 April)

Relevant issues:

Minutes on this from the APA WG call today

matatk commented 6 months ago

Hi @AutoSponge, here are some notes I took about these issues, which I hope will be helpful for us to come to an issue we could post.

Here's what I see as next steps...

What do you think on the above? If I've captured it well, could you enumerate the use cases, and maybe we workshop a comment from there?

AutoSponge commented 5 months ago

In relation to https://github.com/w3c/csswg-drafts/issues/9970

It may be helpful to have a "sticky" feature and a "greater contrast" algorithm.

For example, if I have #6161FF as a background color white (4.5:1) and black (4.66:1) both conform to current specs. The author may have a preference:

IMO, max should restrict the color to the max requested. For example, on a black background, white text reaches 21:1 luminance ratio. But if I requested a 15:1 max (with a base of white on black background) for people with migraines and astigmatism, then I should get something like #D9D9D9. Maybe this works more like a clamp? But this only works in terms of the WCAG calculations. It means nothing to APCA calculations.

AutoSponge commented 5 months ago

Also, since fillColor, color, and icons are a thing, we need to have ways of clamping at 3:1 on the min side and preferring that over a more aggressive 4.5:1. This is useful for a secondary call to action element.