pub fn set_app_theme(theme: Theme)Expand description
App-facing theme override:
set_app_theme forces the app’s active Theme end-to-end — both
delivery paths a shell owned exclusively before this (widget paint/layout
via RenderRoot::set_theme, and use_context::<Theme>() via
provide_context) — reflecting the change the next time the running shell
polls (once per frame; desktop before rebuild, mobile at the top of the
frame callback). clear_app_theme returns to the platform’s own
light/dark-derived default. See frust_shell_common::theme_override’s
module docs for the full layering rationale, the thread contract (a plain
Mutex-guarded process-global — no UI-thread panic, unlike
push_deep_link), and the override-wins-over-appearance rule (an app
override, once set, is never overridden back by a live platform dark-mode
flip until clear_app_theme runs).
use frust::{Brightness, Theme, set_app_theme};
// Force one appearance end-to-end regardless of what the platform reports
// — e.g. an in-app light/dark toggle. Any `Theme` works here; a design
// system passes its own baseline instead of the neutral floor.
set_app_theme(Theme::neutral().with_brightness(Brightness::Dark));Force the app’s active Theme, overriding whatever the platform’s own
light/dark preference would otherwise select — reaching BOTH delivery paths
(widget paint/layout via RenderRoot::set_theme, and use_context::<Theme>()
via provide_context) the next time the running shell polls
ThemeOverrideWatcher::poll (once per frame — see the module docs).
Callable from any thread (see the module docs’ thread contract); the
process-wide slot is a plain Mutex, not a UI-thread-only primitive.