View as Markdown

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

Types