Skip to main content

Crate telar_theme_core

Crate telar_theme_core 

Source

Enums§

ControlSize
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.

Traits§

Theme
ThemeTokens
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.

Functions§

active_mode
Non-reactive read of the active mode id, for the hot-reload snapshot bridge.
control_scale
The factor the catalogue’s metric bases carry here — use_control_size resolved to a number, which is the only form a component ever needs it in.
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 so [is_dark] stays 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.
register_mode
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.
set_control_size
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.
set_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.
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
use_control_size
The ambient control size, subscribing the caller.
use_theme
use_theme_tokens