Skip to content

Commit

Permalink
Fix HSV to HSL conversion (#68)
Browse files Browse the repository at this point in the history
Do not scale lightness back to 0 - 100 until conversions are done
  • Loading branch information
facelessuser authored Jan 30, 2021
1 parent 3c24174 commit 5d30a44
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/spaces/hsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ Color.defineSpace({
s /= 100;
v /= 100;

let l = 100 * v * (1 - s/2);
let l = v * (1 - s/2);

return [
h, // h is the same
(l === 0 || l === 1)? 0 : (v - l) / Math.min(l, 1 - l),
l
(l === 0 || l === 1)? 0 : ((v - l) / Math.min(l, 1 - l)) * 100,
l * 100
];
}
}
Expand Down

0 comments on commit 5d30a44

Please sign in to comment.