Expand description
Slot-typed shorthand accessors against the active theme document.
Widgets speak in terms of slot ids. The plumbing for “which document is active” and “which mode” is captured here so widget code stays free of that plumbing.
Functions§
- Resolve a colour slot in the active mode.
Nonewhen the slot is missing, empty, or not aSlot::Color(usepaint()if a gradient should also be acceptable). - Like
colorbut returnsfallbackwhen the slot is missing. The typical pattern for widgets that must always paint something. - Resolve a paint slot (solid or gradient) in the active mode. A plain
Slot::Coloris promoted toPaint::Solid.Nonefor missing or non-paintable slots (e.g. a text-style). - The eight canonical palette slots of the active mode projected as a
Palettestruct. This is a one-call shortcut equivalent toPalette::from_slots(&active_document().mode(active_mode()).slots), covering the common case where a widget needstext_primary/surface/accent/ etc. without picking specific slot ids. - Resolve a surface slot together with its outer shadow stack.
- Resolve an elevation (outer-shadow stack) slot in the active mode. The returned
Vecis a freshly cloned copy so call sites can hold it across frames without borrowing the global state. - Resolve a surface slot in the active mode. A colour or paint slot promotes to a surface with that fill and no decorations; a full surface slot returns unchanged.
- Resolve a typography slot in the active mode. Cloned so the result can outlive the global-state borrow.
- The active mode’s window-controls payload, derived from slots if the document did not declare an explicit block.