-
Notifications
You must be signed in to change notification settings - Fork 380
Expand file tree
/
Copy pathrelative-luminance.html
More file actions
63 lines (42 loc) · 2.49 KB
/
relative-luminance.html
File metadata and controls
63 lines (42 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<dt><dfn id="dfn-relative-luminance">relative luminance</dfn></dt>
<dd>
<p>the relative brightness of any point in a colorspace, normalized to 0 for darkest
black and 1 for lightest white
</p>
<div class="note">
<p>For the sRGB colorspace, the relative luminance of a color is defined as L = 0.2126
* <strong>R</strong> + 0.7152 * <strong>G</strong> + 0.0722 * <strong>B</strong> where <strong>R</strong>, <strong>G</strong> and <strong>B</strong> are defined as:
</p>
<ul>
<li>if RsRGB <= 0.04045 then <strong>R</strong> = RsRGB/12.92 else <strong>R</strong> = ((RsRGB+0.055)/1.055) ^ 2.4
</li>
<li>if GsRGB <= 0.04045 then <strong>G</strong> = GsRGB/12.92 else <strong>G</strong> = ((GsRGB+0.055)/1.055) ^ 2.4
</li>
<li>if BsRGB <= 0.04045 then <strong>B</strong> = BsRGB/12.92 else <strong>B</strong> = ((BsRGB+0.055)/1.055) ^ 2.4
</li>
</ul>
<p>and RsRGB, GsRGB, and BsRGB are defined as:</p>
<ul>
<li>RsRGB = R8bit/255</li>
<li>GsRGB = G8bit/255</li>
<li>BsRGB = B8bit/255</li>
</ul>
<p>The "^" character is the exponentiation operator. (Formula taken from
[[SRGB]].)
</p>
</div>
<p class="note">Before May 2021 the value of 0.04045 in the definition was different (0.03928). It was taken from an older version of the specification and has been updated. It has no practical effect on the calculations in the context of these guidelines.</p>
<p class="note">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 <a href="https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum">Understanding Success Criterion 1.4.3 Contrast (Minimum)</a>.
</p>
<p class="note">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).
</p>
<p class="note">Tools are available that automatically do the calculations when testing contrast and
flash.
</p>
<p class="note">A <a href="relative-luminance.html">separate page giving the relative luminance definition using MathML</a> to display the formulas is available.
</p>
</dd>