MathML version of the relative luminance definition

The following is a MathML version of the WCAG 2.0 definition of relative luminance. Refer to MathML Software - Browsers for information about browsers that support MathML and can correctly display the information on this page. At the time of publication, support for MathML was not sufficient to include it in the body of the guidelines. If this changes prior to publication, this version will be included in the guidelines themselves.

relative luminance

the relative perceived brightness of any point, normalized to 0 for black and 1 for maximum white

Note 1: The The relative luminance of an sRGB color is defined as L=0.2126×R+0.7152×G+0.0722×B where R, G and B are defined as:

  • If R s R G B 0.03928 then R = R s R G B 12.92 else R = ( R s R G B + 0.055 1.055 ) 2.4

  • If G s R G B 0.03928 then G = G s R G B 12.92 else G = ( G s R G B + 0.055 1.055 ) 2.4

  • If B s R G B 0.03928 then B = B s R G B 12.92 else B = ( B s R G B + 0.055 1.055 ) 2.4

and RsRGB,GsRGB,andBsRGB are defined as:

  • RsRGB=R8bit255
  • GsRGB=G8bit255
  • BsRGB=B8bit255

(Formula taken from [sRGB] and [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.

Note 3: For dithered colors, use average values of the colors used (average R, average G, and average B).

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