Skip to content

Commit

Permalink
fix(design): handle empty value in hexToHsv conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
jikkai committed Feb 5, 2025
1 parent e09e023 commit f221b2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/design/src/components/color-picker/ColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ export function ColorPicker({ format = 'hex', value = '#000000', showAlpha = fal
useEffect(() => {
try {
if (format === 'hex') {
const [h, s, v] = hexToHsv(value);
const [h, s, v] = value ? hexToHsv(value) : hsv;
setHsv([h, s, v]);
setAlpha(1);
}
} catch (error) {
console.error('Invalid RGBA value:', error);
console.error('Invalid value:', error);
}
}, [value]);

Expand Down

0 comments on commit f221b2f

Please sign in to comment.