Skip to content

Commit

Permalink
Use C=0 for achromatic colors, also related to #526
Browse files Browse the repository at this point in the history
  • Loading branch information
LeaVerou committed May 25, 2024
1 parent 0e6ec49 commit f2c5313
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/spaces/lch.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default new ColorSpace({
let [L, a, b] = Lab;
let isAchromatic = Math.abs(a) < this.ε && Math.abs(b) < this.ε;
let h = isAchromatic ? null : constrainAngle(Math.atan2(b, a) * 180 / Math.PI);
let C = Math.sqrt(a ** 2 + b ** 2);
let C = isAchromatic ? 0 : Math.sqrt(a ** 2 + b ** 2);

return [ L, C, h ];
},
Expand Down

0 comments on commit f2c5313

Please sign in to comment.