Replace react-color with custom HSL ColorPicker

Remove the react-color dependency and add a custom ColorPicker implementation. The new component uses HSL parsing and hex<->HSL conversion, provides SatLightPanel and HueSlider subcomponents with mouse/touch drag support, and integrates @heroui/input for inline HEX/HSL editing. The ColorPicker onChange now emits an "hsl(...)" string; theme config parsing was updated to convert that string into the existing "h s% l%" format. Also update package.json to drop react-color.
This commit is contained in:
手瓜一十雪
2026-02-01 14:22:52 +08:00
parent 8f6be073c1
commit 279724edb6
4 changed files with 400 additions and 74 deletions

View File

@@ -500,10 +500,13 @@ const ThemeConfigCard = () => {
return (
<ColorPicker
color={color}
onChange={(result) => {
onChange(
`${result.hsl.h} ${result.hsl.s * 100}% ${result.hsl.l * 100}%`
);
onChange={(hslString) => {
// ColorPicker returns hsl(h, s%, l%) string
// We need to parse it and convert to "h s% l%" format for theme config
const match = hslString.match(/hsl\((\d+(?:\.\d+)?),\s*(\d+(?:\.\d+)?)%,\s*(\d+(?:\.\d+)?)%\)/);
if (match) {
onChange(`${match[1]} ${match[2]}% ${match[3]}%`);
}
}}
/>
);