Skip to content

Commit

Permalink
fix(color): rescale labXyz(), use D50 for LCH->RGB
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Feb 2, 2021
1 parent 69e2287 commit 9e59545
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/color/src/lab/lab-xyz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ const transform = (x: number) => {
* @param white
*/
export const labXyz = (out: Color | null, src: ReadonlyColor, white = D50) => {
const y = (src[0] + 16) / 116;
const y = (src[0] + 0.16) / 1.16;
return setC4(
out || src,
transform(src[1] / 500 + y) * white[0],
transform(src[1] / 5.0 + y) * white[0],
transform(y) * white[1],
transform(y - src[2] / 200) * white[2],
transform(y - src[2] / 2.0) * white[2],
ensureAlpha(src[3])
);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/color/src/rgb/rgb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const rgb = <ColorFactory<RGB>>defColor({
hsv: hsvRgb,
lab50: labRgb,
lab65: labRgbD65,
lch: [lchLab, labRgbD65],
lch: [lchLab, labRgb],
oklab: oklabRgb,
rgb: set4,
srgb: srgbRgb,
Expand Down

0 comments on commit 9e59545

Please sign in to comment.