import {computed, reactive} from "@peryl/react-compose"; import {PlainColor} from "./utils/PlainColor"; export function useColorPanelHistory( { onChange }: { onChange: (color: PlainColor) => void } ) { const state = reactive({ standardColors: [ 'rgb(208, 2, 27)', 'rgb(245, 166, 35)', 'rgb(248, 231, 28)', 'rgb(139, 87, 42)', 'rgb(126, 211, 33)', 'rgb(65, 117, 5)', 'rgb(189, 16, 224)', 'rgb(144, 19, 254)', 'rgb(74, 144, 226)', 'rgb(80, 227, 194)', 'rgb(184, 233, 134)', 'rgb(0, 0, 0)', 'rgb(25, 25, 25)', 'rgb(74, 74, 74)', 'rgb(155, 155, 155)', 'rgb(255, 255, 255)', ] }); const renderContent = computed(() => { const colors = [...state.standardColors]; return () => (
{colors.map(val => (
onChange(new PlainColor(val))} /> ))}
); }); return { renderContent }; }