import { useAppearance } from '@/hooks/useAppearance' import { cn } from '@/lib/utils' import { RgbaColor, RgbaColorPicker } from 'react-colorful' import { IconColorPicker } from '@tabler/icons-react' import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' import { useTheme } from '@/hooks/useTheme' export function ColorPickerAppMainView() { const { appMainViewBgColor, setAppMainViewBgColor } = useAppearance() const { isDark } = useTheme() const predefineAppMainViewBgColor: RgbaColor[] = [ isDark ? { r: 25, g: 25, b: 25, a: 1, } : { r: 255, g: 255, b: 255, a: 1, }, ] return (
{predefineAppMainViewBgColor.map((item, i) => { const isSelected = item.r === appMainViewBgColor.r && item.g === appMainViewBgColor.g && item.b === appMainViewBgColor.b && item.a === appMainViewBgColor.a return (
{ setAppMainViewBgColor(item) }} style={{ backgroundColor: `rgba(${item.r}, ${item.g}, ${item.b}, ${item.a})`, }} /> ) })}
setAppMainViewBgColor(color)} />
) }