Skip to content

Commit

Permalink
remove numeric separators
Browse files Browse the repository at this point in the history
  • Loading branch information
Qix- committed Apr 5, 2022
1 parent 9dcc3b7 commit 5696221
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions 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.040_45) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
lum[i] = (chan <= 0.04045) ? 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 Expand Up @@ -298,7 +298,7 @@ Color.prototype = {
isDark() {
// YIQ equation from http://24ways.org/2010/calculating-color-contrast
const rgb = this.rgb().color;
const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10_000;
const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;
return yiq < 128;
},

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"new-cap": 0,
"unicorn/prefer-module": 0,
"no-mixed-operators": 0,
"complexity": 0
"complexity": 0,
"unicorn/numeric-separators-style": 0
}
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ it('Color() instance (undefined)', () => {
});

it('Immutability', () => {
const c = Color(0xFF_00_00);
const c = Color(0xFF0000);
ok(c !== c.rgb());
ok(c != c.rgb()); // eslint-disable-line eqeqeq
});
Expand Down

0 comments on commit 5696221

Please sign in to comment.