git_iris/theme/builtins/
mod.rs

1//! Builtin themes embedded in the binary.
2
3use super::Theme;
4use super::loader::load_from_str;
5
6// SilkCircuit family
7const SILKCIRCUIT_NEON_TOML: &str = include_str!("silkcircuit_neon.toml");
8const SILKCIRCUIT_SOFT_TOML: &str = include_str!("silkcircuit_soft.toml");
9const SILKCIRCUIT_GLOW_TOML: &str = include_str!("silkcircuit_glow.toml");
10const SILKCIRCUIT_VIBRANT_TOML: &str = include_str!("silkcircuit_vibrant.toml");
11const SILKCIRCUIT_DAWN_TOML: &str = include_str!("silkcircuit_dawn.toml");
12
13// Popular dark themes
14const CATPPUCCIN_MOCHA_TOML: &str = include_str!("catppuccin_mocha.toml");
15const DRACULA_TOML: &str = include_str!("dracula.toml");
16const NORD_TOML: &str = include_str!("nord.toml");
17const TOKYO_NIGHT_TOML: &str = include_str!("tokyo_night.toml");
18const GRUVBOX_DARK_TOML: &str = include_str!("gruvbox_dark.toml");
19const ONE_DARK_TOML: &str = include_str!("one_dark.toml");
20
21// Popular light themes
22const CATPPUCCIN_LATTE_TOML: &str = include_str!("catppuccin_latte.toml");
23const SOLARIZED_LIGHT_TOML: &str = include_str!("solarized_light.toml");
24
25// ═══════════════════════════════════════════════════════════════════════════════
26// SilkCircuit Family
27// ═══════════════════════════════════════════════════════════════════════════════
28
29/// Load the builtin `SilkCircuit` Neon theme (default).
30#[must_use]
31pub fn silkcircuit_neon() -> Theme {
32    load_from_str(SILKCIRCUIT_NEON_TOML, None)
33        .expect("builtin SilkCircuit Neon theme should be valid")
34}
35
36/// Load the builtin `SilkCircuit` Soft theme.
37#[must_use]
38pub fn silkcircuit_soft() -> Theme {
39    load_from_str(SILKCIRCUIT_SOFT_TOML, None)
40        .expect("builtin SilkCircuit Soft theme should be valid")
41}
42
43/// Load the builtin `SilkCircuit` Glow theme.
44#[must_use]
45pub fn silkcircuit_glow() -> Theme {
46    load_from_str(SILKCIRCUIT_GLOW_TOML, None)
47        .expect("builtin SilkCircuit Glow theme should be valid")
48}
49
50/// Load the builtin `SilkCircuit` Vibrant theme.
51#[must_use]
52pub fn silkcircuit_vibrant() -> Theme {
53    load_from_str(SILKCIRCUIT_VIBRANT_TOML, None)
54        .expect("builtin SilkCircuit Vibrant theme should be valid")
55}
56
57/// Load the builtin `SilkCircuit` Dawn theme.
58#[must_use]
59pub fn silkcircuit_dawn() -> Theme {
60    load_from_str(SILKCIRCUIT_DAWN_TOML, None)
61        .expect("builtin SilkCircuit Dawn theme should be valid")
62}
63
64// ═══════════════════════════════════════════════════════════════════════════════
65// Popular Dark Themes
66// ═══════════════════════════════════════════════════════════════════════════════
67
68/// Load the Catppuccin Mocha theme.
69#[must_use]
70pub fn catppuccin_mocha() -> Theme {
71    load_from_str(CATPPUCCIN_MOCHA_TOML, None)
72        .expect("builtin Catppuccin Mocha theme should be valid")
73}
74
75/// Load the Dracula theme.
76#[must_use]
77pub fn dracula() -> Theme {
78    load_from_str(DRACULA_TOML, None).expect("builtin Dracula theme should be valid")
79}
80
81/// Load the Nord theme.
82#[must_use]
83pub fn nord() -> Theme {
84    load_from_str(NORD_TOML, None).expect("builtin Nord theme should be valid")
85}
86
87/// Load the Tokyo Night theme.
88#[must_use]
89pub fn tokyo_night() -> Theme {
90    load_from_str(TOKYO_NIGHT_TOML, None).expect("builtin Tokyo Night theme should be valid")
91}
92
93/// Load the Gruvbox Dark theme.
94#[must_use]
95pub fn gruvbox_dark() -> Theme {
96    load_from_str(GRUVBOX_DARK_TOML, None).expect("builtin Gruvbox Dark theme should be valid")
97}
98
99/// Load the One Dark theme.
100#[must_use]
101pub fn one_dark() -> Theme {
102    load_from_str(ONE_DARK_TOML, None).expect("builtin One Dark theme should be valid")
103}
104
105// ═══════════════════════════════════════════════════════════════════════════════
106// Popular Light Themes
107// ═══════════════════════════════════════════════════════════════════════════════
108
109/// Load the Catppuccin Latte theme.
110#[must_use]
111pub fn catppuccin_latte() -> Theme {
112    load_from_str(CATPPUCCIN_LATTE_TOML, None)
113        .expect("builtin Catppuccin Latte theme should be valid")
114}
115
116/// Load the Solarized Light theme.
117#[must_use]
118pub fn solarized_light() -> Theme {
119    load_from_str(SOLARIZED_LIGHT_TOML, None)
120        .expect("builtin Solarized Light theme should be valid")
121}
122
123// ═══════════════════════════════════════════════════════════════════════════════
124// Theme Registry
125// ═══════════════════════════════════════════════════════════════════════════════
126
127/// Get all builtin theme names (for theme listings).
128#[must_use]
129pub fn builtin_names() -> &'static [(&'static str, &'static str)] {
130    &[
131        // SilkCircuit family (default first)
132        ("silkcircuit-neon", "SilkCircuit Neon"),
133        ("silkcircuit-soft", "SilkCircuit Soft"),
134        ("silkcircuit-glow", "SilkCircuit Glow"),
135        ("silkcircuit-vibrant", "SilkCircuit Vibrant"),
136        ("silkcircuit-dawn", "SilkCircuit Dawn"),
137        // Popular dark themes
138        ("catppuccin-mocha", "Catppuccin Mocha"),
139        ("dracula", "Dracula"),
140        ("nord", "Nord"),
141        ("tokyo-night", "Tokyo Night"),
142        ("gruvbox-dark", "Gruvbox Dark"),
143        ("one-dark", "One Dark"),
144        // Popular light themes
145        ("catppuccin-latte", "Catppuccin Latte"),
146        ("solarized-light", "Solarized Light"),
147    ]
148}
149
150/// Load a builtin theme by name.
151///
152/// Returns `None` if the name is not a builtin theme.
153#[must_use]
154pub fn load_by_name(name: &str) -> Option<Theme> {
155    match name {
156        // SilkCircuit family
157        "silkcircuit-neon" | "default" => Some(silkcircuit_neon()),
158        "silkcircuit-soft" => Some(silkcircuit_soft()),
159        "silkcircuit-glow" => Some(silkcircuit_glow()),
160        "silkcircuit-vibrant" => Some(silkcircuit_vibrant()),
161        "silkcircuit-dawn" => Some(silkcircuit_dawn()),
162        // Popular dark themes
163        "catppuccin-mocha" => Some(catppuccin_mocha()),
164        "dracula" => Some(dracula()),
165        "nord" => Some(nord()),
166        "tokyo-night" => Some(tokyo_night()),
167        "gruvbox-dark" => Some(gruvbox_dark()),
168        "one-dark" => Some(one_dark()),
169        // Popular light themes
170        "catppuccin-latte" => Some(catppuccin_latte()),
171        "solarized-light" => Some(solarized_light()),
172        _ => None,
173    }
174}