更正ColorPicker中HEX输入的问题。
This commit is contained in:
		| @@ -22,15 +22,9 @@ export function ColorComponentInput({ color, onChange }: ColorComponentInputProp | |||||||
|   const updateHex = (evt: ChangeEvent<HTMLInputElement>) => { |   const updateHex = (evt: ChangeEvent<HTMLInputElement>) => { | ||||||
|     try { |     try { | ||||||
|       const hexValue = trim(evt.target.value, '#'); |       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); |       setHex(hexValue); | ||||||
|  |       updateRGB(hexValue); | ||||||
|  |       updateHSL(hexValue); | ||||||
|       onChange(hexValue); |       onChange(hexValue); | ||||||
|     } catch (e) { |     } catch (e) { | ||||||
|       console.error('[Convert HEX]', e); |       console.error('[Convert HEX]', e); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user