From f34a0baee81b4d9bea9c2ffc13abb334cb52f803 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Tue, 5 Apr 2022 10:54:45 +0200 Subject: [PATCH] use correct WCAG luminance constant (fixes #248) --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index bdb850e..9d6d637 100644 --- a/index.js +++ b/index.js @@ -267,7 +267,7 @@ Color.prototype = { const lum = []; for (const [i, element] of rgb.entries()) { const chan = element / 255; - lum[i] = (chan <= 0.039_28) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4; + lum[i] = (chan <= 0.040_45) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4; } return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];