Parent [>]
1//! Built-in color themes.
2
3use clap::ValueEnum;
4
5/// Base stylesheet — layout, navigation, repo list, tree view, blame.
6pub const BASE_CSS: &str = include_str!("../static/base.css");
7
8/// Additional styles for rendered Markdown (README files).
9pub const MARKDOWN_CSS: &str = include_str!("../static/markdown.css");
10
11/// A built-in color theme.  `Auto` and `SolarizedAuto` follow the OS
12/// light/dark preference via `prefers-color-scheme`.
13#[derive(Clone, Default, ValueEnum)]
14pub enum Theme {
15    /// Follows the OS light/dark preference.
16    #[default]
17    Auto,
18    Light,
19    Dark,
20    SolarizedAuto,
21    SolarizedLight,
22    SolarizedDark,
23}
24
25impl Theme {
26    /// Returns the compiled CSS for this theme variant.
27    pub const fn css(&self) -> &'static str {
28        match self {
29            Self::Auto => include_str!("../static/auto.css"),
30            Self::Light => include_str!("../static/light.css"),
31            Self::Dark => include_str!("../static/dark.css"),
32            Self::SolarizedAuto => include_str!("../static/solarized_auto.css"),
33            Self::SolarizedLight => include_str!("../static/solarized_light.css"),
34            Self::SolarizedDark => include_str!("../static/solarized_dark.css"),
35        }
36    }
37}