maycoon_theme/theme/
celeste.rs1use peniko::{color::palette, Color};
2
3use crate::globals::Globals;
4use crate::id::WidgetId;
5use crate::style::{
6 DefaultContainerStyles, DefaultInteractiveStyles, DefaultStyles, DefaultTextStyles, Style,
7 StyleVal,
8};
9use crate::theme::Theme;
10
11#[derive(Debug, Clone)]
13pub enum CelesteTheme {
14 Light(Globals),
16}
17
18impl CelesteTheme {
19 pub fn light() -> Self {
21 Self::Light(Globals::default())
22 }
23}
24
25impl Default for CelesteTheme {
26 fn default() -> Self {
27 Self::light()
28 }
29}
30
31impl Theme for CelesteTheme {
32 fn of(&self, id: WidgetId) -> Option<Style> {
33 match id.namespace() {
34 "maycoon-widgets" => match id.id() {
35 "Text" => Some(Style::from_values([
36 ("color".to_string(), StyleVal::Color(palette::css::BLACK)),
37 (
38 "color_invert".to_string(),
39 StyleVal::Color(palette::css::WHITE),
40 ),
41 ])),
42
43 "Button" => Some(Style::from_values([
44 (
45 "color_idle".to_string(),
46 StyleVal::Color(Color::from_rgb8(150, 170, 250)),
47 ),
48 (
49 "color_pressed".to_string(),
50 StyleVal::Color(Color::from_rgb8(130, 150, 230)),
51 ),
52 (
53 "color_hovered".to_string(),
54 StyleVal::Color(Color::from_rgb8(140, 160, 240)),
55 ),
56 ])),
57
58 "Checkbox" => Some(Style::from_values([
59 (
60 "color_checked".to_string(),
61 StyleVal::Color(Color::from_rgb8(130, 130, 230)),
62 ),
63 (
64 "color_unchecked".to_string(),
65 StyleVal::Color(Color::from_rgb8(170, 170, 250)),
66 ),
67 ])),
68
69 "Slider" => Some(Style::from_values([
70 (
71 "color".to_string(),
72 StyleVal::Color(Color::from_rgb8(130, 130, 230)),
73 ),
74 (
75 "color_ball".to_string(),
76 StyleVal::Color(Color::from_rgb8(170, 170, 250)),
77 ),
78 ])),
79
80 _ => None,
81 },
82 _ => None,
83 }
84 }
85
86 fn defaults(&self) -> DefaultStyles {
87 DefaultStyles::new(
88 DefaultTextStyles::new(palette::css::BLACK, palette::css::WHITE_SMOKE),
89 DefaultContainerStyles::new(palette::css::ANTIQUE_WHITE, palette::css::WHITE),
90 DefaultInteractiveStyles::new(
91 Color::from_rgb8(130, 150, 230),
92 Color::from_rgb8(150, 170, 250),
93 Color::from_rgb8(140, 160, 240),
94 Color::from_rgb8(110, 110, 110),
95 ),
96 )
97 }
98
99 fn window_background(&self) -> Color {
100 Color::WHITE
101 }
102
103 fn globals(&self) -> &Globals {
104 match &self {
105 CelesteTheme::Light(globals) => globals,
106 }
107 }
108
109 fn globals_mut(&mut self) -> &mut Globals {
110 match self {
111 CelesteTheme::Light(globals) => globals,
112 }
113 }
114}