Expand description
Theme system — dark / light mode colour palettes.
§Overview
Visuals holds every colour used by the widget library. Two built-in
palettes are provided via Visuals::dark and Visuals::light.
The current visuals are stored in a thread-local so widgets can access
them from paint() without an extra parameter. Call set_visuals once
per frame (before painting) to apply a palette; call current_visuals to
read it from inside a widget.
DrawCtx::visuals() is a convenience
that delegates to current_visuals, so widget paint methods only need
ctx.visuals().
Structs§
- Visuals
- All colours used by the widget library.
Enums§
- Accent
Color - Built-in accent swatches exposed by the demo and usable by hosts.
- Theme
Preference - User preference for which palette to apply.
Functions§
- current_
visuals - Clone and return the active
Visuals. - current_
visuals_ epoch - Current visuals epoch. See [
VISUALS_EPOCH] docstring for how the widget layer uses it. - set_
visuals - Replace the active
Visuals.