Expand description
Changing the theme while the application runs, and the palettes that come with it.
LaunchBuilder::with_theme settles the theme once, before anything is drawn, and a
const palette rides on it as a &'static reference. An application that lets the
reader pick a design system, a scheme or a brand colour at run time needs to send a new
SetTheme, and a palette built at run time has no 'static home of its own.
ThemeHandle is that path, and the Dioxus adapter’s use_theme hook hands one out.
Setting a theme queues it and it rides out on the batch the current call produces, the
way a message does: one record, applied by the Renderer to the whole tree. A palette handed over by value is owned here, so application code never
leaks anything to satisfy the lifetime.
Structs§
- System
Color Scheme Subscription - A registration for changes of the system appearance, ended by dropping it.
- Theme
Handle - A handle on the running theme.
Copy, so it can move into any number of handlers.
Functions§
- current_
theme - The theme the application is running with: what it launched with, or what it last set.
- own_
palette - A palette made at run time, given a home that lives as long as the program.
- resolved_
color_ scheme - The scheme the theme is drawn in: the theme’s own choice when it names one, and the
system’s when it follows the system.
Noneonly while it follows a system that has not been reported yet. - set_
theme - Replaces the whole theme. The Renderer receives it in the batch this call produces.
- subscribe_
system_ color_ scheme - Registers
notifyto be called each time the system appearance changes. A runtime’s hook for the scheme holds one for as long as the reader it wakes is alive. - system_
color_ scheme - Whether the system appearance is light or dark, as the Renderer last reported it, or
Nonebefore its first report.