summaryrefslogtreecommitdiffstats
path: root/style/src/checkbox.rs
blob: a8b4a11d4f93bd39b2db8a429fbedd15827b71ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//! Show toggle controls using checkboxes.
use iced_core::{Background, Color};

/// The appearance of a checkbox.
#[derive(Debug, Clone, Copy)]
pub struct Appearance {
    pub background: Background,
    pub checkmark_color: Color,
    pub border_radius: f32,
    pub border_width: f32,
    pub border_color: Color,
    pub text_color: Option<Color>,
}

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

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

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