diff --git a/packages/tohuhono/ui/package.json b/packages/tohuhono/ui/package.json index a5c732af..980615a9 100644 --- a/packages/tohuhono/ui/package.json +++ b/packages/tohuhono/ui/package.json @@ -79,6 +79,8 @@ "@tailwindcss/typography": "^0.5.13", "@tohuhono/dev": "workspace:*", "@tohuhono/utils": "workspace:*", + "@uiw/react-color": "^2.3.0", + "@uiw/react-color-chrome": "^2.3.0", "class-variance-authority": "^0.7.0", "cmdk": "^1.0.0", "date-fns": "^3.6.0", diff --git a/packages/tohuhono/ui/src/theme/color-picker.tsx b/packages/tohuhono/ui/src/theme/color-picker.tsx new file mode 100644 index 00000000..077b870a --- /dev/null +++ b/packages/tohuhono/ui/src/theme/color-picker.tsx @@ -0,0 +1,42 @@ +"use client" + +import { PopoverContent } from "@radix-ui/react-popover" +import { + hslaToHsva, + hsvaToHex, + type ColorResult, + type HslColor, +} from "@uiw/react-color" +import ChromeColorPicker from "@uiw/react-color-chrome" +import { Popover, PopoverTrigger } from "../popover" + +export const ColorPicker = ({ + disabled, + color, + onColorChange, +}: { + disabled?: boolean + color: HslColor + onColorChange: (color: ColorResult) => void +}) => { + const hsva = hslaToHsva({ ...color, a: 1 }) + + return ( + + + - {theme.map(({ id, light, dark }) => { - return ( - - - - - - ) - })} + {theme.map(({ id, light, dark }) => ( + + + + + + + ))}