summaryrefslogblamecommitdiffstats
path: root/style/src/toggler.rs
blob: fcc7e45b5479508cec10e3df668b48db11056cf2 (plain) (tree)
1
2
3
4
5
6



                                        
                             
                       







                                                       
                        
 
                                                                         
 
                                                                          
 
//! Show toggle controls using togglers.
use iced_core::Color;

/// The appearance of a toggler.
#[derive(Debug, Clone, Copy)]
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;

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

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