From 9e59545fb0cca91dfe7050a1a7db70239f818e9d Mon Sep 17 00:00:00 2001 From: Karsten Schmidt Date: Tue, 2 Feb 2021 23:54:47 +0000 Subject: [PATCH] fix(color): rescale labXyz(), use D50 for LCH->RGB --- packages/color/src/lab/lab-xyz.ts | 6 +++--- packages/color/src/rgb/rgb.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/color/src/lab/lab-xyz.ts b/packages/color/src/lab/lab-xyz.ts index 5ec4c43c03..5d9ad1f936 100644 --- a/packages/color/src/lab/lab-xyz.ts +++ b/packages/color/src/lab/lab-xyz.ts @@ -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]) ); }; diff --git a/packages/color/src/rgb/rgb.ts b/packages/color/src/rgb/rgb.ts index 42748c80e5..6663c409e9 100644 --- a/packages/color/src/rgb/rgb.ts +++ b/packages/color/src/rgb/rgb.ts @@ -51,7 +51,7 @@ export const rgb = >defColor({ hsv: hsvRgb, lab50: labRgb, lab65: labRgbD65, - lch: [lchLab, labRgbD65], + lch: [lchLab, labRgb], oklab: oklabRgb, rgb: set4, srgb: srgbRgb,