maycoon_theme/theme/mod.rs
1use peniko::Color;
2use std::fmt::Debug;
3
4use crate::globals::Globals;
5use crate::id::WidgetId;
6use crate::style::{DefaultStyles, Style};
7
8/// The Celeste Theme.
9pub mod celeste;
10
11/// Base trait for all themes.
12pub trait Theme: Debug + 'static {
13 /// Return the [Style] of the given widget using its ID.
14 /// Returns [None] if the theme does not have styles for the given widget.
15 /// In that case, you should use [Theme::defaults] to get widget style defaults.
16 fn of(&self, id: WidgetId) -> Option<Style>;
17 /// Get the default widget styles.
18 fn defaults(&self) -> DefaultStyles;
19 /// Get the background color of the window.
20 fn window_background(&self) -> Color;
21 /// Get global style values.
22 fn globals(&self) -> &Globals;
23 /// Get mutable global style values.
24 fn globals_mut(&mut self) -> &mut Globals;
25}