@pbroom/color-kit/driverColor state
ColorState
Single-color picker state. requested is the OKLCH color the user or code asked for, kept unclamped even when it lies outside every display gamut so that later edits do not drift. displayed holds that color gamut-mapped into sRGB and Display P3, which is what should be painted; activeGamut picks which of the two the UI shows (see getActiveDisplayedColor).
import type { ColorState } from '@pbroom/color-kit/driver';color-state.ts:44interface ColorState {
requested: Color;
displayed: { srgb: Color; p3: Color };
activeGamut: GamutTarget;
activeView: ViewModel;
meta: { source: ColorSource; outOfGamut: { srgb: boolean; p3: boolean }; gamutMapMethod: GamutMapMethod };
}Create it with createColorState and update it with the setColor* reducers, which return the same object for a no-op.
Properties
- displayed
{ srgb: Color; p3: Color } requestedmapped into each display gamut withmeta.gamutMapMethod.- activeGamut
GamutTarget - Gamut whose displayed color the UI renders.
- activeView
ViewModel - Model the picker shows channels or text in.
- meta
{ source: ColorSource; outOfGamut: { srgb: boolean; p3: boolean }; gamutMapMethod: GamutMapMethod } - Provenance and gamut status of the current state.
Also exported from
@pbroom/color-kit/reactthe same declaration, re-exported