Skip to main content

ThemeFn

Trait ThemeFn 

Source
pub trait ThemeFn<State, Theme> {
    // Required method
    fn theme(&self, state: &State) -> Option<Theme>;
}
Expand description

The theme logic of some Application.

Any implementors of this trait can be provided as an argument to Application::theme.

iced provides two implementors:

  • the built-in Theme itself
  • and any Fn(&State) -> impl Into<Option<Theme>>.

Required Methods§

Source

fn theme(&self, state: &State) -> Option<Theme>

Returns the theme of the Application for the current state.

If None is returned, iced will try to use a theme that matches the system color scheme.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<State> ThemeFn<State, Theme> for Theme

Source§

fn theme(&self, _state: &State) -> Option<Theme>

Implementors§

Source§

impl<F, T, State, Theme> ThemeFn<State, Theme> for F
where F: Fn(&State) -> T, T: Into<Option<Theme>>,