Traits§
Functions§
- active_
mode - Non-reactive read of the active mode id, for the hot-reload snapshot bridge.
- follow_
system - Drives the active mode from the OS light/dark preference — light →
light, dark →dark— updating live as the OS scheme changes. Installs a reactive effect (kept alive internally) and designates the pair sois_dark/toggle_darkstay consistent. Re-calling replaces the effect (hot reload re-runs setup). A manualset_modestill wins until the next OS change re-drives it. - init_
mode - Selects
defaultonly when no mode is active yet. Called at app start and after a hot reload so a selection restored by the rsx hot-reload bridge is not clobbered by the default. - is_dark
- Reactive:
truewhen the active mode is the designated dark mode.falsewhen it is the light mode, no pair has been set, or a third (unpaired) mode is active. Read this for a sun/moon toggle’s on/off state. - register_
mode - Registers a named mode.
applyinstalls the concrete theme when the mode is selected. Re-registering an id replaces its closure, which is expected: hot reload re-runs the app’s setup and re-registers every mode. - set_
dark - Selects the designated dark (
on = true) or light (on = false) mode. No-op if no pair has been set. - set_
light_ dark - Designates which two registered modes form the light/dark pair. A thin, optional convention over the open
mode registry: it does not replace named modes (a third mode like
"pastel"stays valid) — it only tellsis_dark/set_dark/toggle_darkwhich ids to flip between. Both ids should also be registered viaregister_mode. Does not itself change the active mode. - set_
mode - Selects a mode: runs its registered
applyclosure (if one is registered) and publishes the id to the reactive active-mode signal. Setting an unregistered id still updates the signal, so an app may drive the theme from its own effect onuse_modeinstead of registering closures. - set_
system_ dark - Reports the OS light/dark preference into the reactive graph. Called by the runner at window creation and
whenever the OS scheme changes; drives
follow_system. - set_
theme - toggle_
dark - Flips between the designated light and dark modes. Reads the current scheme non-reactively so it is safe to call from an event handler.
- use_
mode - Reactive read of the active mode id — subscribes the caller so a label re-renders on switch.
Nonebefore any mode is set. - use_
theme - use_
theme_ tokens