Accessible colors

Article published on January 11, 2006 under Accessibility

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.

Color brightness

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

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.

The formula is valid?

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:

  1. all people involved in the experiment did not have specific visual problems such daltonism or color blindness impairments
  2. result are based on personal readability perception of different color combinations and is not related to an objective performance value
  3. experiment has been conducted taking in consideration only a small range of color (web safe palette)
  4. the color difference formula suggested by W3C provide false positive and true negative results

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

The future

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 luminosity:

max + 0.05) : (λmin + 0.05)
λ = 0.2126 * Redlin + 0.7152 * Greenlin + 0.0722 Bluelin Redlin = (Red / FS)

λmax and λmin indicates respectively the highest and lower values of luminosity that can be calculated using the second formula. Redlin, Greenlin and Bluelin are the color linarized coordinates that can be determined using the last formula where FS is full scale value (255 for 8 bit color channels). Text or diagrams and their background must have a luminosity contrast ratio of at least 5:1 for level 2 conformance or at least 10:1 for level 3 conformance.