aboutsummaryrefslogtreecommitdiff
path: root/src/rule.rs
blob: 77cb0ef692c352490fdf74c65c19bd7cf0979ead (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use iced_widget::core::border::Radius;
use iced_widget::rule::{Catalog, FillMode, Style, StyleFn};

use super::Theme;

impl Catalog for Theme {
    type Class<'a> = StyleFn<'a, Self>;

    fn default<'a>() -> Self::Class<'a> {
        Box::new(inset)
    }

    fn style(&self, class: &Self::Class<'_>) -> Style {
        class(self)
    }
}

pub fn inset(theme: &Theme) -> Style {
    Style {
        color: theme.colors().outline.variant,
        fill_mode: FillMode::Padded(8),
        width: 1,
        radius: Radius::default(),
        snap: cfg!(feature = "crisp"),
    }
}
pub fn full_width(theme: &Theme) -> Style {
    Style {
        color: theme.colors().outline.variant,
        fill_mode: FillMode::Full,
        width: 1,
        radius: Radius::default(),
        snap: cfg!(feature = "crisp"),
    }
}