Module color_picker
Expand description
Event-driven: each press latches a DragTarget so a drag continues
to track the cursor even after it leaves the widget rect (see
wants_pointer_capture). All visuals pull colours from theme tokens —
no literal palette values live in this file.
The selected colour can stay widget-local, bind to typed process-local
state with ColorPicker::from_state, or be observed with on_change
for an app-owned durable mutation.
Two optional parts extend the inline picker:
- Swatches (
ColorPicker::with_swatches): a palette of quick picks below the sliders, each a radio button for assistive technology. - Confirm mode (
ColorPicker::confirming): a titled picker whose edits stay pending until Done; Cancel (orEscape) restores the colour it opened with. The host reads the result fromColorPicker::take_outcomeorColorPicker::on_outcome.
The saturation/value field and hue strip paint the real HSV gradients the pointer maps into; every chrome colour (edges, rings, labels, buttons) comes from theme tokens.
Structs§
Enums§
- Color
Picker Outcome - How a confirming picker closed (see
ColorPicker::confirming). - Drag
Target - Which sub-control owns the current pointer drag, set on press and
routed
CursorMovedto the matchingset_*helper until release.