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§
- 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.
- set_
theme - Replaces the whole theme. The Renderer receives it in the batch this call produces.