UseMultiColorReturn
Collection state and operations returned by useMultiColor.
import type { UseMultiColorReturn } from '@pbroom/color-kit/react';use-multi-color.ts:77interface UseMultiColorReturn {
state: MultiColorState;
ids: string[];
selectedId: string | null;
selected: ColorState | null;
setRequested: (id: string, requested: Color, options?: SetRequestedOptions) => void;
setChannel: (id: string, channel: ColorChannel, value: number, options?: Omit<SetRequestedOptions, 'changedChannel'>) => void;
setActiveGamut: (gamut: GamutTarget, source?: ColorSource) => void;
setActiveView: (view: ViewModel, source?: ColorSource) => void;
select: (id: string, interaction?: ColorInteraction) => void;
addColor: (id: string, color: string | Color, source?: ColorSource) => void;
removeColor: (id: string) => void;
renameColor: (id: string, nextId: string, source?: ColorSource) => void;
}Properties
- state
MultiColorState - The full collection state.
- ids
string[] - Entry ids in collection order.
- selectedId
string | null - Id of the selected entry, or
nullwhen the collection is empty. - selected
ColorState | null - State of the selected entry, or
nullwhen nothing is selected. - setRequested
(id: string, requested: Color, options?: SetRequestedOptions) => void - Sets the requested OKLCH color of entry
id. - setChannel
(id: string, channel: ColorChannel, value: number, options?: Omit<SetRequestedOptions, 'changedChannel'>) => void - Sets one OKLCH channel of entry
id. - setActiveGamut
(gamut: GamutTarget, source?: ColorSource) => void - Sets the display gamut shared by all entries;
sourcedefaults to'user'. - setActiveView
(view: ViewModel, source?: ColorSource) => void - Sets the view model shared by all entries;
sourcedefaults to'user'. - select
(id: string, interaction?: ColorInteraction) => void - Selects entry
id; a no-op for unknown or already selected ids. - addColor
(id: string, color: string | Color, source?: ColorSource) => void - Appends an entry (a no-op when
idexists). Selects it when nothing is selected. - removeColor
(id: string) => void - Removes entry
id; removing the selected entry selects the first remaining one. - renameColor
(id: string, nextId: string, source?: ColorSource) => void - Renames entry
idtonextId, keeping its position and selection; a no-op whenidis unknown ornextIdis taken.