From cbcdc543f2990457075088161cfa0597262526a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Wed, 1 Jan 2025 08:26:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=AD=A3ColorPicker=E4=B8=ADHEX?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ColorComponentInput.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/components/ColorComponentInput.tsx b/src/components/ColorComponentInput.tsx index 140a9e2..759e000 100644 --- a/src/components/ColorComponentInput.tsx +++ b/src/components/ColorComponentInput.tsx @@ -22,15 +22,9 @@ export function ColorComponentInput({ color, onChange }: ColorComponentInputProp const updateHex = (evt: ChangeEvent) => { try { const hexValue = trim(evt.target.value, '#'); - const [r, g, b] = colorFn?.represent_rgb(hexValue) ?? [0, 0, 0]; - setR(r); - setG(g); - setB(b); - const [h, s, l] = colorFn?.represent_hsl(hexValue) ?? [0, 0, 0]; - setH(h); - setS(s); - setL(l); setHex(hexValue); + updateRGB(hexValue); + updateHSL(hexValue); onChange(hexValue); } catch (e) { console.error('[Convert HEX]', e);