summaryrefslogtreecommitdiff
path: root/src/theme/text.rs
blob: 9cbd056d4b8f91275cfc7c5469a96b0f15031994 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#![allow(dead_code)]
use iced::widget::text::{Catalog, Style, StyleFn};

use super::OtherTheme;

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

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

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

pub fn none(_: &OtherTheme) -> Style {
    Style { color: None }
}

pub fn primary(theme: &OtherTheme) -> Style {
    Style {
        color: Some(theme.colorscheme.primary.on_primary),
    }
}

pub fn secondary(theme: &OtherTheme) -> Style {
    Style {
        color: Some(theme.colorscheme.secondary.on_secondary),
    }
}

pub fn tertiary(theme: &OtherTheme) -> Style {
    Style {
        color: Some(theme.colorscheme.tertiary.on_tertiary),
    }
}

pub fn error(theme: &OtherTheme) -> Style {
    Style {
        color: Some(theme.colorscheme.error.on_error),
    }
}

pub fn surface(theme: &OtherTheme) -> Style {
    Style {
        color: Some(theme.colorscheme.surface.on_surface),
    }
}