Closed eric-g-97477 closed 11 months ago
Looking at color.js, I see the following function:
luminosity: function () { // http://www.w3.org/TR/WCAG20/#relativeluminancedef var rgb = this.rgb().color; var lum = []; for (var i = 0; i < rgb.length; i++) { var chan = rgb[i] / 255; lum[i] = (chan <= 0.04045) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4); } return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2]; },
Focusing on (chan <= 0.04045), I looked at http://www.w3.org/TR/WCAG20/#relativeluminancedef and saw if RsRGB <= 0.03928 then R = RsRGB/12.92 else R = ((RsRGB+0.055)/1.055) ^ 2.4
(chan <= 0.04045)
if RsRGB <= 0.03928 then R = RsRGB/12.92 else R = ((RsRGB+0.055)/1.055) ^ 2.4
Shouldn't 0.04045 be 0.03928? Or, what is the reason for the discrepancy? I have not understood something?
The link is outdated, it should refer to WCAG 2.1. The value as been adjusted in WCAG 2.1: https://www.w3.org/TR/WCAG21/#dfn-relative-luminance
Looking at color.js, I see the following function:
Focusing on
(chan <= 0.04045)
, I looked at http://www.w3.org/TR/WCAG20/#relativeluminancedef and sawif RsRGB <= 0.03928 then R = RsRGB/12.92 else R = ((RsRGB+0.055)/1.055) ^ 2.4
Shouldn't 0.04045 be 0.03928? Or, what is the reason for the discrepancy? I have not understood something?