pub fn use_theme() -> ThemeContextExpand description
Hook to access the theme context
§Panics
Panics if called outside of a ThemeProvider
§Example
ⓘ
use dioxus_ui_system::theme::use_theme;
fn MyComponent() -> Element {
let theme = use_theme();
let bg_color = theme.tokens.read().colors.background.to_rgba();
rsx! {
div { style: "background-color: {bg_color}", "Hello" }
}
}