freya_components/
element_expansions.rs1use freya_core::prelude::*;
2
3use crate::theming::hooks::get_theme_or_default;
4
5pub trait RectThemeExt {
6 fn theme_background(self) -> Self;
7 fn theme_color(self) -> Self;
8}
9
10impl RectThemeExt for Rect {
11 fn theme_background(self) -> Self {
12 let theme = get_theme_or_default();
13 self.background(theme.colors.background)
14 }
15
16 fn theme_color(self) -> Self {
17 let theme = get_theme_or_default();
18 self.color(theme.colors.text_primary)
19 }
20}
21
22pub trait LabelThemeExt {
23 fn theme_color(self) -> Self;
24}
25
26impl LabelThemeExt for Label {
27 fn theme_color(self) -> Self {
28 let theme = get_theme_or_default();
29 self.color(theme.colors.text_primary)
30 }
31}
32
33pub trait ParagraphThemeExt {
34 fn theme_color(self) -> Self;
35}
36
37impl ParagraphThemeExt for Paragraph {
38 fn theme_color(self) -> Self {
39 let theme = get_theme_or_default();
40 self.color(theme.colors.text_primary)
41 }
42}