Skip to main content

Module provider

Module provider 

Source
Expand description

Global theme provider: use_theme() and set_theme().

Enums§

ThemeMode
Whether the active theme should follow the OS light/dark setting, or is pinned by the app/user. Mirrors rosace_core::platform’s enum+atom shape.

Functions§

register_theme_pair
Registers the app’s own light/dark ThemeData — call once at startup (e.g. rosace_theme::register_theme_pair(crate::theme::light(), crate::theme::dark())) so ThemeMode::System/set_theme_mode apply YOUR themes rather than the generic built_in::light_theme()/dark_theme(). A second call is a no-op (first registration wins, matching OnceLock semantics) — call it exactly once, before the first frame.
set_animations
Replaces the active theme with theme and notifies all subscribers.
set_theme
set_theme_mode
Pins the theme to mode. Passing ThemeMode::System re-enables following the OS setting on the next sync_system_theme call (e.g. the next native env-push, or call it directly to apply immediately).
sync_system_theme
Applies the OS brightness (rosace_core::media_query().is_dark) to the active theme, but only while use_theme_mode() == ThemeMode::System — an app/user that pinned Light/Dark via set_theme_mode is left alone. Native platform code calls this right after every rosace_core::set_media_query(..) push.
use_theme
Returns a clone of the currently active ThemeData.
use_theme_mode
Returns the active theme mode (System by default).