Skip to content

Commit

Permalink
update YIQ formula constants (fixes #107, ref chartjs#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qix- committed Apr 5, 2022
1 parent f34a0ba commit 9dcc3b7
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 @@ -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] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;
const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10_000;
return yiq < 128;
},

Expand Down

0 comments on commit 9dcc3b7

Please sign in to comment.