Skip to main content

gecol_core/theme/
mod.rs

1mod color;
2mod theme_struct;
3
4use std::str::FromStr;
5
6pub use color::Color;
7use serde::{Deserialize, Serialize};
8pub use theme_struct::Theme;
9
10/// Represents the theme type.
11#[derive(
12    Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Default,
13)]
14pub enum ThemeType {
15    #[default]
16    Dark,
17    Light,
18}
19
20impl FromStr for ThemeType {
21    type Err = String;
22
23    fn from_str(s: &str) -> Result<Self, Self::Err> {
24        match s.to_lowercase().as_str() {
25            "dark" => Ok(ThemeType::Dark),
26            "light" => Ok(ThemeType::Light),
27            _ => Err("Invalid theme type.".to_owned()),
28        }
29    }
30}