-
Notifications
You must be signed in to change notification settings - Fork 746
Description
I like the basic thrust, but working on design systems, I often need more control than max-contrast from a list. I’d like to see these uses considered as well:
* min contrast to meet a particular ratio (from list) * adjust given color to meet a particular ratio
I imagine the latter may open up too much complexity - but I’d consider the former a primary use-case.
Currently, the color-contrast() function takes two arguments: a color, and a list of colors.
This requirement could be addressed by adding a third parameter, which is a target contrast ratio. Instead of comparing the whole list, comparisons stop once the target contrast ratio has been reached or exceeded.
This assumes that the list is in order of desirability, but the resolution of #4732 already implies this (if two colors in the list have the same contrast, the earlier in the list wins; this implies the stylesheet author put them in order of desirability).
color-contrast() = color-contrast( <color> <color># number?)
The number is optional and if omitted, the whole list is searched to fi 644D nd the highest contrast ratio.
So for example
color-contrast(tan var(--blue1), var(--blue2), var(--blue3), var(--blue4) 4.5)