Re: [css-color] shifting a color to make adequate contrast with another color

I was able to find where the problem got pushed to:

color(white contrast(#c54f4f 50%)) -> rgb(128, 128, 128) (contrast=1.2)

The min and max can be on opposite sides, and combining them can
produce a color with insufficient contrast.

If I remove the shortcut for colors that already provide enough
contrast it stops being able to interpolate to something with not
enough contrast, but now the color can be really really far (which is
exactly what you were saying, but I didn't understand the first time):

color(white contrast(#c54f4f 50%)) -> rgb(3, 3, 3)

white to nearly black is about as far as you can go. It was
surprisingly difficult to find a color pair that did this though.

To be honest, I don't much like the percentage anyway. :) Because
neither 0% nor 100% represent no change, it is difficult to predict
what a given percentage will do. The difference between 0 and 100 can
be really small or really large depending on the color. It seems more
helpful to provide the needed ratio, since the accessibility rating
requires different contrast ratios at different text sizes, and
different users have different needs.

color(white contrast(rgb(196, 79, 79) 4.5)) -> white
color(white contrast(rgb(196, 79, 79) 7)) -> black
color(rgb(196, 79, 79) contrast(white 4.5)) -> rgb(196, 79, 79)
color(rgb(196, 79, 79) contrast(white 7)) -> rgb(148, 61, 61)

-Andy

Received on Tuesday, 17 March 2015 04:35:50 UTC