Relative luminance

From WCAG WG

WCAG definition of relative luminance

the relative brightness of any point in a colorspace, normalized to 0 for darkest black and 1 for lightest white

ERRATA NOTICE

The relative luminance definition as listed below and in the WCAG 2.x specification is known to be incorrect and not per the official IEC standard for sRGB.

Specifically, the correct threshold for the piecewise equation is 0.04045 and not the 0.03928 that is listed below. Nevertheless for 8 bit color values the difference is not significant, as detailed here.

Also, relative luminance is more correctly symbolized as Y while L is normally used for absolute luminance as measured in nits (cd/m2).

New Methodology for WCAG 3

The WCAG 3 contrast specifications are following a new paradigm based on modern vision science. The W3 Wiki overview with additional links and discussion is available here on the W3 Silver Wiki.

Definition as Stated in WCAG 2.x

Note 1: For the sRGB colorspace, the relative luminance of a color is defined as L = 0.2126 * R + 0.7152 * G + 0.0722 * B where R, G and B are defined as:

  • if RsRGB <= 0.03928 then R = RsRGB/12.92 else R = ((RsRGB+0.055)/1.055) ^ 2.4
  • if GsRGB <= 0.03928 then G = GsRGB/12.92 else G = ((GsRGB+0.055)/1.055) ^ 2.4
  • if BsRGB <= 0.03928 then B = BsRGB/12.92 else B = ((BsRGB+0.055)/1.055) ^ 2.4

and RsRGB, GsRGB, and BsRGB are defined as:

  • RsRGB = R8bit/255
  • GsRGB = G8bit/255
  • BsRGB = B8bit/255

The "^" character is the exponentiation operator. (Formula taken from the obsolete [IEC-4WD]).

Note 2: Almost all systems used today to view Web content assume sRGB encoding. Unless it is known that another color space will be used to process and display the content, authors should evaluate using sRGB colorspace. If using other color spaces, see Understanding Success Criterion 1.4.3.

Note 3: If dithering occurs after delivery, then the source color value is used. For colors that are dithered at the source, the average values of the colors that are dithered should be used (average R, average G, and average B).

Note 4: Tools are available that automatically do the calculations when testing contrast and flash.

Note 5: A MathML version of the relative luminance definition is available.

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."