API reference
@salmonui/inputs/color-picker
36 exported symbols: 6 components, 5 functions, 19 interfaces and 6 types. Each name links its page with the signature, docs and members.
import { … } from '@salmonui/inputs/color-picker';Components
ColorAreaSaturation (inline axis) by brightness (block axis) of the current hue: a CSS-gradient square with a thumb and two visually hidden range inputs, so assistive t…ColorFieldA text field for a color: accepts hex, rgb() and hsl() text and parses it on blur or Enter (parseColor); text that does not parse is reverted. Shows the value…ColorPickerColor picker: a trigger button with a swatch preview that opens a popover, or an inline panel. The panel composes the parts: ColorArea, hue and alpha ColorSlid…ColorSliderOne channel of a color: a CSS-gradient track with a thumb over a visually hidden range input (APG Slider). aria-valuetext names the hue ("120°, green") or the…ColorSwatchA color preview: role="img" named by the color, the color over a checkerboard so alpha shows, or a struck-through box for no color. Pure markup, server rendere…ColorSwatchPickerA palette as an APG listbox laid out as a grid: one tab stop (roving tabindex), arrows move by cell and row (ArrowLeft / ArrowRight mirrored in right-to-left c…
Functions
colorNameAn English description of the color for aria-valuetext and swatch names ('dark vibrant green', 'light gray', 'transparent'). Components take localeText.colorNa…hslColorA color from HSL (hue 0-360, saturation and lightness 0-100) and alpha.hsvColorA color from HSV (hue 0-360, saturation and brightness 0-100) and alpha.parseColorParses #rgb, #rgba, #rrggbb, #rrggbbaa, rgb() / rgba() and hsl() / hsla() (comma or space syntax, percentages, deg) and transparent. Throws a TypeError for any…rgbColorA color from RGB (0-255) and alpha (0-1).
Interfaces
ColorAn immutable color. Channels: hue 0-360, saturation / brightness / lightness 0-100, alpha 0-1, rgb 0-255.ColorAreaPropsColorChangeDetailsSecond argument of onValueChange / onValueCommit of ColorArea and ColorSlider.ColorFieldChangeDetailsSecond argument of ColorField onValueChange.ColorFieldPropsColorPartLocaleTextStrings of the color parts; colorName and hueName replace the English descriptions in aria-valuetext.ColorPartPropsProps shared by ColorArea and ColorSlider.ColorPickerBeforeModeChangeEventArgument of onBeforeModeChange.ColorPickerBeforeOpenChangeEventArgument of onBeforeOpenChange.ColorPickerCancelableEventA cancellable event: preventDefault() vetoes the change.ColorPickerChangeDetailsSecond argument of onValueChange and onValueCommit.ColorPickerOpenChangeDetailsSecond argument of onOpenChange.ColorPickerPropsColorSliderPropsColorSwatchGroupA labelled group of palette entries.ColorSwatchPickerPropsColorSwatchPropsSwatchChangeDetailsSecond argument of onValueChange.SwatchRenderContextArgument of renderSwatch.
Types
ColorChangeSourceWhere a change came from.ColorFormatSerialization formats of a color value.ColorInputA value prop of the color components: a color string or a Color.ColorPickerLocaleTextUser-visible strings of ColorPicker.ColorPickerMode'area' (saturation and brightness area, sliders, hex field) or 'swatches' (palette).ColorSwatchItemA palette entry: a color string, or a color with its accessible name.