Whether this runtime has an eyedropper to open; false off a browser and where it is
unsupported. The view never calls it, since a server and a browser would then draw
different markup: the application reads it where it learns its environment and passes
the answer as eyedropper.
A color in sRGB as the area draws it: hue 0–360 degrees, saturation and
value (brightness) 0–1, and alpha 0–1. Hue is kept apart from the other
channels, so dragging to grey and back does not lose it.
The color a CSS literal names, for presets and initial values written in
code: ColorPicker.color('#3b82f6'). It throws on text that names none, so
a typo fails where it is written rather than drawing black.
A color picker after ReUI's: a 2D area of saturation (across) and
brightness (up) at the color's hue, hue and alpha sliders (two Sliders of
this package), an eyedropper when the application asks for one, the color as text
in a chosen format (hex, rgb, hsl or oklch) that the user can type into,
and presets, a radio group of swatches. popover draws it in the
package's Popover, opened by a swatch of the color.
The color, the format and the text being typed are a small Model of this
module's, which the application keeps and folds with update. Every key,
press and drag reaches update as a Message that says what was done (a
key, a point of the area), not the color the last frame drew, so keys
faster than a frame each move from the color before them.
The area is one focusable thumb, role="slider" with both values in its
aria-valuetext, as the APG has no two-dimensional slider: its value is the
saturation and Up and Down move the brightness. Arrows step by 1% (with
Shift by 10%), Page Up and Page Down move the brightness by 10% (with Shift
the saturation), Home and End take the saturation to its ends. The plane is
drawn the same way in either direction, so its keys are physical too. A
press or drag on it, a Mount, says where in it the pointer is, from 0 to 1
each way.
The root carries the color for the recipe as custom properties computed
from it: --fk-color (with alpha), --fk-color-opaque, --fk-color-hue
(the pure hue the area runs to), --fk-color-area (the area's paint),
--fk-color-hues (the hue track's stops), and --fk-color-x,
--fk-color-y (the thumb's place, 0 to 1). A preset carries its own
--fk-color. The sliders take a style of their own (slider), since they
are Sliders; Recipes.Slider({ track: 'paint', label: 'hidden' }) paints
them from what each channel (data-channel) sets.
The application's own ColorPicker: base for every use, presets chosen
at a use with preset, and the call over both. mixins concatenate in
that order and words merge word by word; any other option given at the
call replaces the preset's. The inline view only: a picker in a popover
is ColorPicker.popover, which takes the same options.
The color CSS text names, or none: hex (#rgb, #rgba, #rrggbb,
#rrggbbaa, the # optional), rgb(), hsl() and oklch(), with commas
or spaces and an optional alpha. A channel out of its range is none; an
oklch color outside sRGB is clipped into it. hue is kept for a grey,
which has none of its own.
The picker behind a swatch of its color and its text, in the package's
Popover. The panel opens on the area's thumb, and closes on Escape, a press
outside, or focus leaving it (unless a mouse opened it); a press or a drag
anywhere inside keeps it open, whatever opened it. The open state is the
Popover's Model.