Expand description
Process-wide active theme state.
The active document is published once and read by every per-slot
accessor in crate::theme. First access triggers a disk load of the
default theme; if that fails, an embedded B/W document takes over
and the is_fallback_active flag flips on so the draw layer can paint
a warning banner.
Functions§
- The currently loaded theme document. Use this for slot-typed lookups when the per-slot helpers (
crate::theme::color,crate::theme::surface(), …) are not expressive enough — e.g. iteratingmode.slots.entries. - The active variant (light or dark).
- The id of the active theme.
truewhen the active theme was produced by the embedded B/W fallback becauseThemeDocument::find("default")failed at first-access. Flipped back tofalsethe moment a consumer callsset_active_documentwith any document (even another call to the same fallback — the point is “this state came from an explicit install, not from the missing-theme code path”).- Install
docas the active theme. The current mode is preserved (defaulting toThemeMode::Lightif nothing was set yet). Also clears the fallback flag — an explicit install supersedes the embedded B/W document and the warning banner stops painting from the next frame on. - Switch the active variant. The document is left untouched — if nothing has been loaded yet, the default theme is loaded first.