Contrast ratio
WCAG definition of contrast ratio
(L1 + 0.05) / (L2 + 0.05), where
- L1 is the relative luminance of the lighter of the colors, and
- L2 is the relative luminance of the darker of the colors.
Note 1: Contrast ratios can range from 1 to 21 (commonly written 1:1 to 21:1).
Note 2: Because authors do not have control over user settings as to how text is rendered (for example font smoothing or anti-aliasing), the contrast ratio for text can be evaluated with anti-aliasing turned off.
Note 3: For the purpose of Success Criteria 1.4.3 and 1.4.6, contrast is measured with respect to the specified background over which the text is rendered in normal usage. If no background color is specified, then white is assumed.
Note 4: Background color is the specified color of content over which the text is to be rendered in normal usage. It is a failure if no background color is specified when the text color is specified, because the user's default background color is unknown and cannot be evaluated for sufficient contrast. For the same reason, it is a failure if no text color is specified when a background color is specified.
Note 5: When there is a border around the letter, the border can add contrast and would be used in calculating the contrast between the letter and its background. A narrow border around the letter would be used as the letter. A wide border around the letter that fills in the inner details of the letters acts as a halo and would be considered background.
Note 6: WCAG conformance should be evaluated for color pairs specified in the content that an author would expect to appear adjacent in typical presentation. Authors need not consider unusual presentations, such as color changes made by the user agent, except where caused by authors' code.
Additional guidance when applying to Electronic Documents and Software Aspects of Products
This applies directly as written, and as described in WCAG 2.0 glossary replacing "Web Content" with "Content".
NOTE: Because relative luminance is defined such that it cannot directly apply to hardware we draw the readers' attention to the note in the introduction which reads:
"This document does not comment on hardware aspects of products, non-UI aspects of platforms, or the application of WCAG 2.0 for user-interface components as a category, because the basic constructs on which the WCAG 2.0 and/or its conformance are built do not apply to these."