Skip to content

Commit 85fc150

Browse files
Myndexricokahler
andauthored
fix: corrected threshold for luminance (#472)
The correct threshold is 0.04045, as recited in the official IEC standard for sRGB. And while it was incorrect (0.03928) for a long time in WCAG2, it was corrected by the W3 AGWG in May 2021. Current WCAG 2.1 and 2.2 reflect the correct 0.04045 threshold. Co-authored-by: Rico Kahler <[email protected]>
1 parent 439966f commit 85fc150

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/getLuminance.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function getLuminance(color: string): number {
1010

1111
function f(x: number) {
1212
const channel = x / 255;
13-
return channel <= 0.03928
13+
return channel <= 0.04045
1414
? channel / 12.92
1515
: Math.pow(((channel + 0.055) / 1.055), 2.4);
1616
}

0 commit comments

Comments
 (0)