Checkpoint 2.2 of "Techniques for accessibility evaluation and repair tools"suggest to ensure that foreground and background color combinations provide sufficient contrast when viewed by someone having color deficits or when viewed on a black and white screen. In order to validate
Checkpoint 2.2 of "Techniques for accessibility evaluation and repair tools"suggest to ensure that foreground and background color combinations provide sufficient contrast when viewed by someone having color deficits or when viewed on a black and white screen. In order to validate color combinations the document propose two algorithms (one for color brightness the other for color difference) that combined together can assure if foreground and background colors are visible or not.
Brightness for our purposes can be assumed as the intensity of light illuminating an object (the real definition is the perception elicited by the luminance of a visual target) and can be calculated as the arithmetic mean μ of the Red, Green and Blue color coordinates. W3C suggest the following formula to determine color brightness:
μ = ((Red X 299) + (Green X 587) + (Blue X 114)) / 1000
A visible color need to asses its brightness on a value greater than 125.
Color difference indicates in W3C document the hue difference between the foreground and the background color assuming that hue refers to the gradation of color within the optical spectrum of light. The following formula is suggested by W3C to calculate the color difference:
δRed = max(Red foreground, Red background) - min(Red foreground, Red background)
δGreen = max(Green foreground, Green background) - min(Green foreground, Green background)
δBlue = max(Blue foreground, Blue background) - min(Blue foreground, Blue background)
φ = (δRed) + (δGreen) + (δBlue)
Background and foreground color are visible if color difference has a value greater than 500.
W3C assert that the formulas has been tested using a sample of 149 volunteers where 80% of them reported some visual impairment (acuity problems, myopia, hypermetropia, presbyopia). However there are some lacks that invalidates the results obtained by W3C:
This last point is quite the most tangible because it invalidates the W3C result as we can see from this example:
Foreground color: #990000
Background color: #eeddbb;
This combination is not valid because color difference value is 493. This is a true negative
Foreground color: #0055ff
Background color: #fecf81;
This combination is valid because color difference value is 502. This is a false positive
W3C is investigating new algorithms that can be used to determine if colors are visible or not. Gregg Vanderheiden, Dave Kelso, and Aries Arditi have proposed an alternative formula based on lu