Skip to content

Commit

Permalink
Merge pull request #85 from facelessuser/bugfix/deltae-2000
Browse files Browse the repository at this point in the history
Fix error in Delta E algorithm
  • Loading branch information
svgeesus authored Apr 3, 2021
2 parents ccb846e + ce1b802 commit 13135c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/deltaE/deltaE2000.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Color.prototype.deltaE2000 = function (sample, {kL = 1, kC = 1, kH = 1} = {}) {
let habs = Math.abs(hdiff);
let Δh;

if (Cdash1 == 0 && Cdash2 == 0) {
if (Cdash1 * Cdash2 === 0) {
Δh = 0;
}
else if (habs <= 180) {
Expand Down Expand Up @@ -112,7 +112,7 @@ Color.prototype.deltaE2000 = function (sample, {kL = 1, kC = 1, kH = 1} = {}) {
// Four possibilities for hue weighting factor,
// depending on the angles, to get the correct sign
let hdash;
if (Cdash1 == 0 && Cdash2 == 0) {
if (Cdash1 * Cdash2 === 0) {
hdash = hsum; // which should be zero
}
else if (habs <= 180) {
Expand Down

0 comments on commit 13135c9

Please sign in to comment.