summaryrefslogtreecommitdiff
path: root/material_theme/src/text.rs
blob: 10b2e655aca806d35d7fc2dbddfa0db7b2a616d8 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#![allow(dead_code)]
use iced_widget::text::{Catalog, Style, StyleFn};

use crate::Theme;

impl Catalog for Theme {
    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(_: &Theme) -> Style {
    Style { color: None }
}

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

pub fn primary_container(theme: &Theme) -> Style {
    Style {
        color: Some(theme.colorscheme.primary.on_primary_container),
    }
}

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

pub fn secondary_container(theme: &Theme) -> Style {
    Style {
        color: Some(theme.colorscheme.secondary.on_secondary_container),
    }
}

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

pub fn tertiary_container(theme: &Theme) -> Style {
    Style {
        color: Some(theme.colorscheme.tertiary.on_tertiary_container),
    }
}

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

pub fn error_container(theme: &Theme) -> Style {
    Style {
        color: Some(theme.colorscheme.error.on_error_container),
    }
}

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

pub fn surface_variant(theme: &Theme) -> Style {
    Style {
        color: Some(theme.colorscheme.surface.on_surface_variant),
    }
}

pub fn inverse_surface(theme: &Theme) -> Style {
    Style {
        color: Some(theme.colorscheme.inverse.inverse_on_surface),
    }
}