RampWEB

Test Color Contrast


Color Brightness Formula

The following is the formula suggested by the World Wide Web Consortium (W3C) to determine the brightness of a color.

((Red value X 299) + (Green value X 587) + (Blue value X 114)) / 1000

The difference between the background brightness, and the foreground brightness should be greater than 125.

Color Difference Formula

The following is the formula suggested by the W3C to determine the difference between two colors.

(maximum (Red value 1, Red value 2) - minimum (Red value 1, Red value 2)) + (maximum (Green value 1, Green value 2) - minimum (Green value 1, Green value 2)) + (maximum (Blue value 1, Blue value 2) - minimum (Blue value 1, Blue value 2))

The difference between the background color and the foreground color should be greater than 500.

Luminosity Contrast Ratio Formula

WCAG 2.0 Guideline 1.4: Make it easy to distinguish foreground information from background images or sounds.

(L1+.05) / (L2+.05) where L is luminosity and is defined as .2126*R + .7152*G + .0722B using linearized R, G, and B values. Linearized R (for example) = (R/FS)^2.2 where FS is full scale value (255 for 8 bit color channels). L1 is the higher value (of text or background) and L2 is the lower value.

Text or diagrams, and their background, must have a luminosity contrast ratio of at least 5:1. (Level 2)