We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a1be4e4 commit 78f3362Copy full SHA for 78f3362
wcag2.js
@@ -14,13 +14,16 @@ export var contrast = function(fg, bg) {
14
// `c >= 1 ? c : 1 / c` gives you the actual value.
15
// See also `getAbsRange()`.
16
17
+ // replaced with standard WCAG2 due to rounding errors with xi's version
18
+
19
var yfg = sRGBtoY(fg);
20
var ybg = sRGBtoY(bg);
- return (ybg + 0.05) / (yfg + 0.05);
21
22
+ return yfg>ybg? (yfg + 0.05) / (ybg + 0.05):(ybg + 0.05) / (yfg + 0.05);
23
};
24
25
export var abs = function(c) {
- return c < 1 ? 1 / c : c;
26
+ return c;
27
28
29
export var getAbsRange = function(range) {
0 commit comments