Contrast Tests

WCAG 2.1 contrast, sRGB

white black 21
white white 1
#ffe white 1.010070
#afbaae white 2.008125
#8b9986 white 3.000644
#765 white 5.502984

WCAG 2.1 contrast, Display P3

color(display-p3 0.555354 0.5982801 0.5316741) white 3.000644

WCAG 2.1 contrast, LCH

lch(50% 0 0) white 4.4836

WCAG 2.1 contrast, With NaN

lch(50% 0 NaN) white 4.4836

APCA contrast, sRGB

Test results from apca-w3 test. First color is text, second is background.

#888 #fff 63.056469930209424
#fff #888 -68.54146436644962
#000 #aaa 58.146262578561334
#aaa #000 -56.24113336839742
#123 #def 91.66830811481631
#def #123 -93.06770049484275
#123 #444 8.32326136957393
#444 #123 -7.526878460278154

APCA contrast, sRGB gamut in other color spaces

Same colors as previous tests, all in sRGB gamut, in other color spaces. First color is text, second is background.

color(display-p3 0.5333333 0.5333333 0.5333333) #fff 63.056469930209424
#fff color(prophoto-rgb 0.4590162 0.4590162 0.4590162) -68.54146436644962
#000 color(rec2020 0.6301706 0.6301706 0.6301706) 58.146262578561334
color(xyz-d65 0.3820622 0.4019778 0.437777) #000 -56.24113336839742
hsl(210 50% 13.333333%) lch(93.207946% 10.778089 252.00404) 91.66830811481631
oklch(94.162468% 0.0293154 248.13928) oklch(24.619227% 0.0398483 249.73161) -93.06770049484275
color(display-p3 0.0819793 0.1316305 0.1944321) color(a98-rgb 0.2735638 0.2735638 0.2735638) 8.32326136957393
hwb(0 26.666667% 73.333333%) hwb(210 6.6666667% 80%) -7.526878460278154

APCA contrast, outside sRGB gamut

color(display-p3 1 1 0) #fff 0
color(display-p3 1 1 0) #000 -102.29879033895834
#fff color(display-p3 1 1 0) 0
#000 color(display-p3 1 1 0) 100.98312326509509

Lstar contrast, sRGB

Same test color pairs as apca-w3 test.

#888 #fff 43.29658976448289
#fff #888 43.29658976448289
#000 #aaa 69.61016686067734
#aaa #000 69.61016686067734
#123 #def 80.77804435335543
#def #123 80.77804435335543
#123 #444 16.42200146571048
#444 #123 16.42200146571048

Weber contrast, sRGB

Same test color pairs as apca-w3 test.

#888 #fff 3.0617165365103394
#fff #888 3.0617165365103394
#000 #aaa 0
#aaa #000 0
#123 #def 54.745740598838104
#def #123 54.745740598838104
#123 #444 2.8480815999063975
#444 #123 2.8480815999063975

Michelson contrast, sRGB

Same test color pairs as apca-w3 test.

#888 #fff 0.6048771230917556
#fff #888 0.6048771230917556
#000 #aaa 1
#aaa #000 1
#123 #def 0.9647550639238472
#def #123 0.9647550639238472
#123 #444 0.5874656895134326
#444 #123 0.5874656895134326