Skip to content

Commit

Permalink
use correct WCAG luminance constant (fixes #248)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qix- committed Apr 5, 2022
1 parent 4ac1315 commit f34a0ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit f34a0ba

Please sign in to comment.