Expand description
ColorSwatch — single clickable color cell with Role::ColorWell.
Public widget so apps can compose their own swatch rows or palettes
outside of the bundled SwatchGrid. Renders an optional checkerboard
underlay when color.a() < 1.0 so transparent swatches read correctly.
The displayed color is a Prop<Color> — pass a static Color for a
fixed palette entry or a Signal<Color> for a live preview that
re-paints whenever the bound value changes (used by ColorPicker’s
current-color preview and ColorEdit’s trigger swatch).
§Accessibility
Declares Role::ColorWell; set_color_value carries the RGBA value
and set_value carries the formatted hex string so braille and
voice output both have a human-readable form. Selected swatches
append a localized “selected” suffix to their announced name.
let _swatch = ColorSwatch::new(Color::new(0.21, 0.52, 0.89, 1.0))
.size(24.0)
.corner_radius(4.0);Structs§
- Color
Swatch - Single-cell color swatch.