Skip to main content

Module color_picker

Module color_picker 

Source
Expand description

ColorPicker — embeddable composite color selector.

Combines a 2D HSV canvas, 1D hue and alpha strips, RGB and HSV component spinners, a hex input, a current-color preview, and an optional preset swatch grid into a single bound widget. Driven by a Signal<Color> (or Signal<Option<Color>>) source of truth — every subcomponent reads from / writes to the same signal so the various representations stay in lockstep.

§Layouts

  • ColorPickerLayout::Compact — HSV canvas + hue strip + hex input. Minimal vertical footprint, suitable for popovers.
  • ColorPickerLayout::Standard (default) — HSV canvas + hue strip + alpha strip (when enabled), with RGB spinners, hex input, and preset swatches stacked beneath. The everything-on layout for inspector panes and settings dialogs.
  • ColorPickerLayout::Wide — HSV canvas with strips on the right, spinners stacked vertically alongside the swatch grid. For wide property pages.

§Accessibility

Root: Role::Group with a localized label and Live::Polite so screen readers announce committed color changes. The HSV canvas’s subtree is excluded from the AT tree (no ARIA precedent for 2D pointer gestures); the hue strip, alpha strip, RGB / HSV spinners, hex input, current-color preview, and swatch grid each carry their own appropriate role and value.

Re-exports§

pub use self::swatch::ColorSwatch;

Modules§

alpha_strip
AlphaStrip — 1D opacity slider with a checkerboard background + tinted gradient overlay.
hsv_canvas
HsvCanvas — 2D saturation × value picker rendered as three stacked gradients.
hue_strip
HueStrip — 1D hue slider rendered from a CPU-generated 256×1 rainbow texture.
state
Internal state for ColorPicker.
swatch
ColorSwatch — single clickable color cell with Role::ColorWell.
swatch_grid
SwatchGrid — Role::Grid container of color swatches with arrow-key roving focus, mirroring the Calendar widget’s grid pattern.

Structs§

ColorPicker
Embeddable HSV+RGB+hex+alpha+swatches color picker.

Enums§

ColorPickerLayout
Layout variant — controls how the recipe arranges the rows. Re-exported from color_picker_style so the config and any custom ColorPickerStyle impl can branch on it without an upward dep on teksilo-widgets.

Constants§

DEFAULT_SWATCHES
Default 12-color preset palette (Int UI–flavored). Apps can use this verbatim or pass their own via ColorPicker::swatches.