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/// A dummy theme for testing purposes.
12pub mod dummy;
13
14/// Base trait for all themes.
15pub trait Theme: Debug + 'static {
16    /// Return the [Style] of the given widget using its ID.
17    /// Returns [None] if the theme does not have styles for the given widget.
18    /// In that case, you should use [Theme::defaults] to get widget style defaults.
19    fn of(&self, id: WidgetId) -> Option<Style>;
20    /// Get the default widget styles.
21    fn defaults(&self) -> DefaultStyles;
22    /// Get the background color of the window.
23    fn window_background(&self) -> Color;
24    /// Get global style values.
25    fn globals(&self) -> &Globals;
26    /// Get mutable global style values.
27    fn globals_mut(&mut self) -> &mut Globals;
28}