The following is a MathML version of the WCAG 2.0 definition of relative luminance. Refer to MathML Software - Browsers for information about browsers and plugins that support MathML which you may need in order to correctly display the information on this page.
the relative brightness of any point in a colorspace, normalized to 0 for darkest black and 1 for lightest white
Note 1: For the sRGB colorspace, the relative luminance of a color is defined as $L=0.2126\times R+0.7152\times G+0.0722\times B$ where R, G and B are defined as:
If ${R}_{sRGB}\le 0.03928$ then $R=\frac{{R}_{sRGB}}{12.92}$ else $R={\left(\frac{{R}_{sRGB}+0.055}{1.055}\right)}^{2.4}$
If ${G}_{sRGB}\le 0.03928$ then $G=\frac{{G}_{sRGB}}{12.92}$ else $G={\left(\frac{{G}_{sRGB}+0.055}{1.055}\right)}^{2.4}$
If ${B}_{sRGB}\le 0.03928$ then $B=\frac{{B}_{sRGB}}{12.92}$ else $B={\left(\frac{{B}_{sRGB}+0.055}{1.055}\right)}^{2.4}$
and ${R}_{sRGB},{G}_{sRGB},\phantom{\rule{1ex}{0ex}}\text{and}\phantom{\rule{1ex}{0ex}}{B}_{sRGB}$ are defined as:
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.