Parent [>]
1//! Built-in color themes.
2
3use clap::ValueEnum;
4
5pub const BASE_CSS: &str = include_str!("../static/base.css");
6pub const MARKDOWN_CSS: &str = include_str!("../static/markdown.css");
7
8/// A built-in color theme.  `Auto` and `SolarizedAuto` follow the OS
9/// light/dark preference via `prefers-color-scheme`.
10#[derive(Clone, Default, ValueEnum)]
11pub enum Theme {
12    /// Follows the OS light/dark preference.
13    #[default]
14    Auto,
15    Light,
16    Dark,
17    SolarizedAuto,
18    SolarizedLight,
19    SolarizedDark,
20}
21
22impl Theme {
23    pub fn css(&self) -> &'static str {
24        match self {
25            Theme::Auto => include_str!("../static/auto.css"),
26            Theme::Light => include_str!("../static/light.css"),
27            Theme::Dark => include_str!("../static/dark.css"),
28            Theme::SolarizedAuto => include_str!("../static/solarized_auto.css"),
29            Theme::SolarizedLight => include_str!("../static/solarized_light.css"),
30            Theme::SolarizedDark => include_str!("../static/solarized_dark.css"),
31        }
32    }
33}