Skip to content

Commit 316967d

Browse files
authored
fix: replaced luminance threshold constant 0.03928 with 0.04045 (#4934)
Closes: #4933 Updates the luminance calculation constant from 0.03928 to 0.04045 in lib/commons/color/get-contrast.js to align with the corrected WCAG 2.2 standard. While the practical impact on contrast ratios is minimal, this change ensures standards compliance with the current WCAG guidelines.
1 parent d0e6d8e commit 316967d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/commons/color/color.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ export default class Color {
230230
const { r: rSRGB, g: gSRGB, b: bSRGB } = this;
231231

232232
const r =
233-
rSRGB <= 0.03928 ? rSRGB / 12.92 : Math.pow((rSRGB + 0.055) / 1.055, 2.4);
233+
rSRGB <= 0.04045 ? rSRGB / 12.92 : Math.pow((rSRGB + 0.055) / 1.055, 2.4);
234234
const g =
235-
gSRGB <= 0.03928 ? gSRGB / 12.92 : Math.pow((gSRGB + 0.055) / 1.055, 2.4);
235+
gSRGB <= 0.04045 ? gSRGB / 12.92 : Math.pow((gSRGB + 0.055) / 1.055, 2.4);
236236
const b =
237-
bSRGB <= 0.03928 ? bSRGB / 12.92 : Math.pow((bSRGB + 0.055) / 1.055, 2.4);
237+
bSRGB <= 0.04045 ? bSRGB / 12.92 : Math.pow((bSRGB + 0.055) / 1.055, 2.4);
238238

239239
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
240240
}

0 commit comments

Comments
 (0)