summaryrefslogtreecommitdiffstats
path: root/style/src/toggler.rs
blob: 4ee7db46c5e91cd2bc27ad41d86776da38d9a703 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//! Show toggle controls using togglers.
use iced_core::Color;

/// The appearance of a toggler.
#[derive(Debug)]
pub struct Appearance {
    pub background: Color,
    pub background_border: Option<Color>,
    pub foreground: Color,
    pub foreground_border: Option<Color>,
}

/// A set of rules that dictate the style of a toggler.
pub trait StyleSheet {
    type Style: Default + Copy;

    fn active(&self, style: Self::Style, is_active: bool) -> Appearance;

    fn hovered(&self, style: Self::Style, is_active: bool) -> Appearance;
}