How large the controls in this part of the tree are, in the sense SwiftUI’s controlSize means: a
preference the container expresses and each control interprets, not a size any one of them is given.
Opt-in semantic-token contract the built-in component catalogue reads through, so a component can resolve a
token without knowing the concrete theme type.
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 so
is_dark/toggle_dark stay consistent. Re-calling replaces the effect (hot reload re-runs setup). A
manual set_mode still wins until the next OS change re-drives it.
Selects default only 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.
Reactive: true when the active mode is the designated dark mode. false when 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.
Registers a named mode. apply installs 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.
Sets the ambient control size. Reactive: everything that read it re-runs, so a switch re-spaces the
controls already on screen rather than waiting for whatever rebuilds them.
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 tells
is_dark/set_dark/toggle_dark which ids to flip between. Both ids should also be registered via
register_mode. Does not itself change the active mode.
Selects a mode: runs its registered apply closure (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 on use_mode instead of registering closures.
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.