pub trait ActiveTheme {
// Required methods
fn theme(&self) -> &Theme;
fn colors(&self) -> &ThemeColors;
fn layout(&self) -> &LayoutTheme;
fn components(&self) -> &ComponentThemes;
fn role(&self, color: Color) -> &RoleColor;
fn is_dark_theme(&self) -> bool;
fn reduce_motion(&self) -> bool;
}Expand description
Convenience extension trait giving every GPUI context access to the theme.
Works with &App, &mut App, Context<T> (they deref to App).
Required Methods§
Sourcefn colors(&self) -> &ThemeColors
fn colors(&self) -> &ThemeColors
The active theme’s semantic colors.
Sourcefn layout(&self) -> &LayoutTheme
fn layout(&self) -> &LayoutTheme
The active theme’s layout tokens.
Sourcefn components(&self) -> &ComponentThemes
fn components(&self) -> &ComponentThemes
The active theme’s typed component defaults and recipes.
Sourcefn is_dark_theme(&self) -> bool
fn is_dark_theme(&self) -> bool
Whether the active theme’s appearance is dark.
Sourcefn reduce_motion(&self) -> bool
fn reduce_motion(&self) -> bool
Whether animations should be suppressed. Components must check this before animating; v3 requires no opt-in from the caller.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".