Skip to main content

ActiveTheme

Trait ActiveTheme 

Source
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§

Source

fn theme(&self) -> &Theme

The active theme.

Source

fn colors(&self) -> &ThemeColors

The active theme’s semantic colors.

Source

fn layout(&self) -> &LayoutTheme

The active theme’s layout tokens.

Source

fn components(&self) -> &ComponentThemes

The active theme’s typed component defaults and recipes.

Source

fn role(&self, color: Color) -> &RoleColor

The active theme’s RoleColor for a semantic Color.

Source

fn is_dark_theme(&self) -> bool

Whether the active theme’s appearance is dark.

Source

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

Implementations on Foreign Types§

Source§

impl ActiveTheme for App

Implementors§