WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Color Contrast Formula

for

From: Michael D. Roush
Date: Mar 15, 2005 10:27AM


tim.harshbarger.cqwg wrote:
> http://www.w3.org/TR/AERT#color-contrast
>
> The color brightness formula seems straightforward. We are not so
> certain about the color difference formula. What is meant by max and
> min values?

I've always understood it to mean the larger and smaller of the 'red
values' in the two colors that are being compared. The formula
max(red1,red2)-min(red1,red2) might also be understood as "The absolute
value of the difference between red1 and red2", or even simpler
"Subtract the smaller one from the larger one".

For example, I am using rgb(153,255,51) for a font color on a background
of rgb(204,102,204)....

max(red1,red2)-min(red1,red2) = 204 - 153 = 51
max(grn1,grn2)-min(grn1,grn2) = 255 - 102 = 153
max(blu1,blu2)-min(blu1,blu2) = 204 - 51 = 153

51 + 153 + 153 = 357 (Quite a bit below the 500 standard.)

If I change the font color to rgb(102,204,0), I get a color difference
value of 510, just above what I need to satisfy the formula.

Now, the example I just gave was intentional. I find both of these
terribly hard to read. I find the 'passable' example even more
difficult than the one that doesn't pass the formula.

Moral of the story.... keep the 500 number in mind as a guide if you
wish, but don't rely on a 500+ score to guarantee good color contrast.

Of course, that's if I'm understanding their formula right....

Michael Roush
<EMAIL REMOVED>