Skip to main content

kimun_notes/settings/themes/
builtin.rs

1//! Built-in theme definitions.
2//!
3//! Each constructor maps a popular terminal color scheme's official palette
4//! onto the UI roles of [`Theme`]. Custom themes live as `.toml` files in the
5//! themes config directory instead — see `AppSettings::theme_list()`.
6
7use super::{Theme, ThemeColor};
8
9impl Theme {
10    /// Every built-in theme, in presentation order.
11    pub fn builtins() -> Vec<Theme> {
12        vec![
13            Theme::gruvbox_dark(),
14            Theme::gruvbox_light(),
15            Theme::catppuccin_mocha(),
16            Theme::catppuccin_latte(),
17            Theme::tokyo_night(),
18            Theme::tokyo_night_storm(),
19            Theme::solarized_dark(),
20            Theme::solarized_light(),
21            Theme::nord(),
22            Theme::dracula(),
23            Theme::alucard(),
24            Theme::one_dark(),
25            Theme::one_light(),
26            Theme::monokai(),
27            Theme::everforest_dark(),
28            Theme::everforest_light(),
29            Theme::rose_pine(),
30            Theme::rose_pine_dawn(),
31            Theme::kanagawa_wave(),
32            Theme::kanagawa_lotus(),
33            Theme::ansi(),
34        ]
35    }
36
37    pub fn gruvbox_dark() -> Self {
38        Theme {
39            name: "Gruvbox Dark".to_string(),
40            bg: ThemeColor::from_string("#282828").unwrap(),
41            bg_hard: ThemeColor::from_string("#1d2021").unwrap(),
42            bg_soft: ThemeColor::from_string("#3c3836").unwrap(),
43            bg_panel: ThemeColor::from_string("#32302f").unwrap(),
44            selection_bg: ThemeColor::from_string("#504945").unwrap(),
45            fg: ThemeColor::from_string("#ebdbb2").unwrap(),
46            fg_bright: ThemeColor::from_string("#fbf1c7").unwrap(),
47            cursor: ThemeColor::from_string("#ebdbb2").unwrap(),
48            red: ThemeColor::from_string("#fb4934").unwrap(),
49            green: ThemeColor::from_string("#b8bb26").unwrap(),
50            yellow: ThemeColor::from_string("#fabd2f").unwrap(),
51            blue: ThemeColor::from_string("#83a598").unwrap(),
52            purple: ThemeColor::from_string("#d3869b").unwrap(),
53            aqua: ThemeColor::from_string("#8ec07c").unwrap(),
54            orange: ThemeColor::from_string("#fe8019").unwrap(),
55            fg_secondary: ThemeColor::from_string("#a89984").unwrap(),
56            gray: ThemeColor::from_string("#7c6f64").unwrap(),
57            selection_fg: ThemeColor::from_string("#fbf1c7").unwrap(),
58            border_dim: ThemeColor::from_string("#504945").unwrap(),
59            focus_border: ThemeColor::from_string("#b8bb26").unwrap(),
60            accent: ThemeColor::from_string("#fabd2f").unwrap(),
61            color_directory: ThemeColor::from_string("#83a598").unwrap(),
62            color_journal_date: ThemeColor::from_string("#8ec07c").unwrap(),
63            color_search_match: ThemeColor::from_string("#b8bb26").unwrap(),
64            color_tag: ThemeColor::from_string("#fe8019").unwrap(),
65            blockquote_bar: ThemeColor::from_string("#fabd2f").unwrap(),
66            code_bg: ThemeColor::from_string("#32302f").unwrap(),
67            color_replace_preview: ThemeColor::from_string("#4c3a4a").unwrap(),
68        }
69    }
70
71    pub fn gruvbox_light() -> Self {
72        Theme {
73            name: "Gruvbox Light".to_string(),
74            bg: ThemeColor::from_string("#fbf1c7").unwrap(),
75            bg_hard: ThemeColor::from_string("#f9f5d7").unwrap(),
76            bg_soft: ThemeColor::from_string("#ebdbb2").unwrap(),
77            bg_panel: ThemeColor::from_string("#f2e5bc").unwrap(),
78            selection_bg: ThemeColor::from_string("#ebdbb2").unwrap(),
79            fg: ThemeColor::from_string("#3c3836").unwrap(),
80            fg_bright: ThemeColor::from_string("#282828").unwrap(),
81            cursor: ThemeColor::from_string("#3c3836").unwrap(),
82            red: ThemeColor::from_string("#9d0006").unwrap(),
83            green: ThemeColor::from_string("#79740e").unwrap(),
84            yellow: ThemeColor::from_string("#b57614").unwrap(),
85            blue: ThemeColor::from_string("#076678").unwrap(),
86            purple: ThemeColor::from_string("#8f3f71").unwrap(),
87            aqua: ThemeColor::from_string("#427b58").unwrap(),
88            orange: ThemeColor::from_string("#af3a03").unwrap(),
89            fg_secondary: ThemeColor::from_string("#7c6f64").unwrap(),
90            gray: ThemeColor::from_string("#a89984").unwrap(),
91            selection_fg: ThemeColor::from_string("#282828").unwrap(),
92            border_dim: ThemeColor::from_string("#d5c4a1").unwrap(),
93            focus_border: ThemeColor::from_string("#79740e").unwrap(),
94            accent: ThemeColor::from_string("#d79921").unwrap(),
95            color_directory: ThemeColor::from_string("#458588").unwrap(),
96            color_journal_date: ThemeColor::from_string("#689d6a").unwrap(),
97            color_search_match: ThemeColor::from_string("#98971a").unwrap(),
98            color_tag: ThemeColor::from_string("#af3a03").unwrap(),
99            blockquote_bar: ThemeColor::from_string("#d79921").unwrap(),
100            code_bg: ThemeColor::from_string("#f2e5bc").unwrap(),
101            color_replace_preview: ThemeColor::from_string("#e8d5e0").unwrap(),
102        }
103    }
104
105    pub fn catppuccin_mocha() -> Self {
106        Theme {
107            name: "Catppuccin Mocha".to_string(),
108            bg: ThemeColor::from_string("#1e1e2e").unwrap(),
109            bg_hard: ThemeColor::from_string("#11111b").unwrap(),
110            bg_soft: ThemeColor::from_string("#313244").unwrap(),
111            bg_panel: ThemeColor::from_string("#181825").unwrap(),
112            selection_bg: ThemeColor::from_string("#313244").unwrap(),
113            fg: ThemeColor::from_string("#cdd6f4").unwrap(),
114            fg_bright: ThemeColor::from_string("#f5e0dc").unwrap(),
115            cursor: ThemeColor::from_string("#f5e0dc").unwrap(),
116            red: ThemeColor::from_string("#f38ba8").unwrap(),
117            green: ThemeColor::from_string("#a6e3a1").unwrap(),
118            yellow: ThemeColor::from_string("#f9e2af").unwrap(),
119            blue: ThemeColor::from_string("#89b4fa").unwrap(),
120            purple: ThemeColor::from_string("#cba6f7").unwrap(),
121            aqua: ThemeColor::from_string("#94e2d5").unwrap(),
122            orange: ThemeColor::from_string("#fab387").unwrap(),
123            fg_secondary: ThemeColor::from_string("#a6adc8").unwrap(),
124            gray: ThemeColor::from_string("#6c7086").unwrap(),
125            selection_fg: ThemeColor::from_string("#cdd6f4").unwrap(),
126            border_dim: ThemeColor::from_string("#45475a").unwrap(),
127            focus_border: ThemeColor::from_string("#a6e3a1").unwrap(),
128            accent: ThemeColor::from_string("#cba6f7").unwrap(),
129            color_directory: ThemeColor::from_string("#89dceb").unwrap(),
130            color_journal_date: ThemeColor::from_string("#94e2d5").unwrap(),
131            color_search_match: ThemeColor::from_string("#a6e3a1").unwrap(),
132            color_tag: ThemeColor::from_string("#fab387").unwrap(),
133            blockquote_bar: ThemeColor::from_string("#cba6f7").unwrap(),
134            code_bg: ThemeColor::from_string("#181825").unwrap(),
135            color_replace_preview: ThemeColor::from_string("#3e3450").unwrap(),
136        }
137    }
138
139    pub fn catppuccin_latte() -> Self {
140        Theme {
141            name: "Catppuccin Latte".to_string(),
142            bg: ThemeColor::from_string("#eff1f5").unwrap(),
143            bg_hard: ThemeColor::from_string("#dce0e8").unwrap(),
144            bg_soft: ThemeColor::from_string("#ccd0da").unwrap(),
145            bg_panel: ThemeColor::from_string("#e6e9ef").unwrap(),
146            selection_bg: ThemeColor::from_string("#ccd0da").unwrap(),
147            fg: ThemeColor::from_string("#4c4f69").unwrap(),
148            fg_bright: ThemeColor::from_string("#4c4f69").unwrap(),
149            cursor: ThemeColor::from_string("#dc8a78").unwrap(),
150            red: ThemeColor::from_string("#d20f39").unwrap(),
151            green: ThemeColor::from_string("#40a02b").unwrap(),
152            yellow: ThemeColor::from_string("#df8e1d").unwrap(),
153            blue: ThemeColor::from_string("#1e66f5").unwrap(),
154            purple: ThemeColor::from_string("#8839ef").unwrap(),
155            aqua: ThemeColor::from_string("#179299").unwrap(),
156            orange: ThemeColor::from_string("#fe640b").unwrap(),
157            fg_secondary: ThemeColor::from_string("#6c6f85").unwrap(),
158            gray: ThemeColor::from_string("#9ca0b0").unwrap(),
159            selection_fg: ThemeColor::from_string("#4c4f69").unwrap(),
160            border_dim: ThemeColor::from_string("#ccd0da").unwrap(),
161            focus_border: ThemeColor::from_string("#40a02b").unwrap(),
162            accent: ThemeColor::from_string("#8839ef").unwrap(),
163            color_directory: ThemeColor::from_string("#04a5e5").unwrap(),
164            color_journal_date: ThemeColor::from_string("#179299").unwrap(),
165            color_search_match: ThemeColor::from_string("#40a02b").unwrap(),
166            color_tag: ThemeColor::from_string("#fe640b").unwrap(),
167            blockquote_bar: ThemeColor::from_string("#8839ef").unwrap(),
168            code_bg: ThemeColor::from_string("#e6e9ef").unwrap(),
169            color_replace_preview: ThemeColor::from_string("#dcd0e8").unwrap(),
170        }
171    }
172
173    pub fn tokyo_night() -> Self {
174        Theme {
175            name: "Tokyo Night".to_string(),
176            bg: ThemeColor::from_string("#1a1b26").unwrap(),
177            bg_hard: ThemeColor::from_string("#16161e").unwrap(),
178            bg_soft: ThemeColor::from_string("#292e42").unwrap(),
179            bg_panel: ThemeColor::from_string("#16161e").unwrap(),
180            selection_bg: ThemeColor::from_string("#292e42").unwrap(),
181            fg: ThemeColor::from_string("#c0caf5").unwrap(),
182            fg_bright: ThemeColor::from_string("#c0caf5").unwrap(),
183            cursor: ThemeColor::from_string("#c0caf5").unwrap(),
184            red: ThemeColor::from_string("#f7768e").unwrap(),
185            green: ThemeColor::from_string("#9ece6a").unwrap(),
186            yellow: ThemeColor::from_string("#e0af68").unwrap(),
187            blue: ThemeColor::from_string("#7aa2f7").unwrap(),
188            purple: ThemeColor::from_string("#bb9af7").unwrap(),
189            aqua: ThemeColor::from_string("#7dcfff").unwrap(),
190            orange: ThemeColor::from_string("#ff9e64").unwrap(),
191            fg_secondary: ThemeColor::from_string("#a9b1d6").unwrap(),
192            gray: ThemeColor::from_string("#565f89").unwrap(),
193            selection_fg: ThemeColor::from_string("#c0caf5").unwrap(),
194            border_dim: ThemeColor::from_string("#3b4261").unwrap(),
195            focus_border: ThemeColor::from_string("#9ece6a").unwrap(),
196            accent: ThemeColor::from_string("#7aa2f7").unwrap(),
197            color_directory: ThemeColor::from_string("#7dcfff").unwrap(),
198            color_journal_date: ThemeColor::from_string("#73daca").unwrap(),
199            color_search_match: ThemeColor::from_string("#9ece6a").unwrap(),
200            color_tag: ThemeColor::from_string("#ff9e64").unwrap(),
201            blockquote_bar: ThemeColor::from_string("#7aa2f7").unwrap(),
202            code_bg: ThemeColor::from_string("#16161e").unwrap(),
203            color_replace_preview: ThemeColor::from_string("#3a2b4d").unwrap(),
204        }
205    }
206
207    pub fn tokyo_night_storm() -> Self {
208        Theme {
209            name: "Tokyo Night Storm".to_string(),
210            bg: ThemeColor::from_string("#24283b").unwrap(),
211            bg_hard: ThemeColor::from_string("#1f2335").unwrap(),
212            bg_soft: ThemeColor::from_string("#292e42").unwrap(),
213            bg_panel: ThemeColor::from_string("#1f2335").unwrap(),
214            selection_bg: ThemeColor::from_string("#364a82").unwrap(),
215            fg: ThemeColor::from_string("#c0caf5").unwrap(),
216            fg_bright: ThemeColor::from_string("#c0caf5").unwrap(),
217            cursor: ThemeColor::from_string("#c0caf5").unwrap(),
218            red: ThemeColor::from_string("#f7768e").unwrap(),
219            green: ThemeColor::from_string("#9ece6a").unwrap(),
220            yellow: ThemeColor::from_string("#e0af68").unwrap(),
221            blue: ThemeColor::from_string("#7aa2f7").unwrap(),
222            purple: ThemeColor::from_string("#bb9af7").unwrap(),
223            aqua: ThemeColor::from_string("#7dcfff").unwrap(),
224            orange: ThemeColor::from_string("#ff9e64").unwrap(),
225            fg_secondary: ThemeColor::from_string("#a9b1d6").unwrap(),
226            gray: ThemeColor::from_string("#565f89").unwrap(),
227            selection_fg: ThemeColor::from_string("#c0caf5").unwrap(),
228            border_dim: ThemeColor::from_string("#3b4261").unwrap(),
229            focus_border: ThemeColor::from_string("#9ece6a").unwrap(),
230            accent: ThemeColor::from_string("#bb9af7").unwrap(),
231            color_directory: ThemeColor::from_string("#7dcfff").unwrap(),
232            color_journal_date: ThemeColor::from_string("#73daca").unwrap(),
233            color_search_match: ThemeColor::from_string("#9ece6a").unwrap(),
234            color_tag: ThemeColor::from_string("#ff9e64").unwrap(),
235            blockquote_bar: ThemeColor::from_string("#bb9af7").unwrap(),
236            code_bg: ThemeColor::from_string("#1f2335").unwrap(),
237            color_replace_preview: ThemeColor::from_string("#43356b").unwrap(),
238        }
239    }
240
241    pub fn solarized_dark() -> Self {
242        Theme {
243            name: "Solarized Dark".to_string(),
244            bg: ThemeColor::from_string("#002b36").unwrap(),
245            bg_hard: ThemeColor::from_string("#073642").unwrap(),
246            bg_soft: ThemeColor::from_string("#073642").unwrap(),
247            bg_panel: ThemeColor::from_string("#073642").unwrap(),
248            selection_bg: ThemeColor::from_string("#586e75").unwrap(),
249            fg: ThemeColor::from_string("#839496").unwrap(),
250            fg_bright: ThemeColor::from_string("#fdf6e3").unwrap(),
251            cursor: ThemeColor::from_string("#839496").unwrap(),
252            red: ThemeColor::from_string("#dc322f").unwrap(),
253            green: ThemeColor::from_string("#859900").unwrap(),
254            yellow: ThemeColor::from_string("#b58900").unwrap(),
255            blue: ThemeColor::from_string("#268bd2").unwrap(),
256            purple: ThemeColor::from_string("#6c71c4").unwrap(),
257            aqua: ThemeColor::from_string("#2aa198").unwrap(),
258            orange: ThemeColor::from_string("#cb4b16").unwrap(),
259            fg_secondary: ThemeColor::from_string("#657b83").unwrap(),
260            gray: ThemeColor::from_string("#586e75").unwrap(),
261            selection_fg: ThemeColor::from_string("#eee8d5").unwrap(),
262            border_dim: ThemeColor::from_string("#073642").unwrap(),
263            focus_border: ThemeColor::from_string("#859900").unwrap(),
264            accent: ThemeColor::from_string("#268bd2").unwrap(),
265            color_directory: ThemeColor::from_string("#2aa198").unwrap(),
266            color_journal_date: ThemeColor::from_string("#859900").unwrap(),
267            color_search_match: ThemeColor::from_string("#b58900").unwrap(),
268            color_tag: ThemeColor::from_string("#cb4b16").unwrap(),
269            blockquote_bar: ThemeColor::from_string("#268bd2").unwrap(),
270            code_bg: ThemeColor::from_string("#073642").unwrap(),
271            color_replace_preview: ThemeColor::from_string("#3b3a5e").unwrap(),
272        }
273    }
274
275    pub fn solarized_light() -> Self {
276        Theme {
277            name: "Solarized Light".to_string(),
278            bg: ThemeColor::from_string("#fdf6e3").unwrap(),
279            bg_hard: ThemeColor::from_string("#eee8d5").unwrap(),
280            bg_soft: ThemeColor::from_string("#eee8d5").unwrap(),
281            bg_panel: ThemeColor::from_string("#eee8d5").unwrap(),
282            selection_bg: ThemeColor::from_string("#93a1a1").unwrap(),
283            fg: ThemeColor::from_string("#657b83").unwrap(),
284            fg_bright: ThemeColor::from_string("#002b36").unwrap(),
285            cursor: ThemeColor::from_string("#657b83").unwrap(),
286            red: ThemeColor::from_string("#dc322f").unwrap(),
287            green: ThemeColor::from_string("#859900").unwrap(),
288            yellow: ThemeColor::from_string("#b58900").unwrap(),
289            blue: ThemeColor::from_string("#268bd2").unwrap(),
290            purple: ThemeColor::from_string("#6c71c4").unwrap(),
291            aqua: ThemeColor::from_string("#2aa198").unwrap(),
292            orange: ThemeColor::from_string("#cb4b16").unwrap(),
293            fg_secondary: ThemeColor::from_string("#839496").unwrap(),
294            gray: ThemeColor::from_string("#93a1a1").unwrap(),
295            selection_fg: ThemeColor::from_string("#073642").unwrap(),
296            border_dim: ThemeColor::from_string("#eee8d5").unwrap(),
297            focus_border: ThemeColor::from_string("#859900").unwrap(),
298            accent: ThemeColor::from_string("#268bd2").unwrap(),
299            color_directory: ThemeColor::from_string("#2aa198").unwrap(),
300            color_journal_date: ThemeColor::from_string("#859900").unwrap(),
301            color_search_match: ThemeColor::from_string("#b58900").unwrap(),
302            color_tag: ThemeColor::from_string("#cb4b16").unwrap(),
303            blockquote_bar: ThemeColor::from_string("#268bd2").unwrap(),
304            code_bg: ThemeColor::from_string("#eee8d5").unwrap(),
305            color_replace_preview: ThemeColor::from_string("#ddd6e8").unwrap(),
306        }
307    }
308
309    pub fn nord() -> Self {
310        Theme {
311            name: "Nord".to_string(),
312            bg: ThemeColor::from_string("#2e3440").unwrap(),
313            bg_hard: ThemeColor::from_string("#3b4252").unwrap(),
314            bg_soft: ThemeColor::from_string("#434c5e").unwrap(),
315            bg_panel: ThemeColor::from_string("#3b4252").unwrap(),
316            selection_bg: ThemeColor::from_string("#434c5e").unwrap(),
317            fg: ThemeColor::from_string("#eceff4").unwrap(),
318            fg_bright: ThemeColor::from_string("#eceff4").unwrap(),
319            cursor: ThemeColor::from_string("#d8dee9").unwrap(),
320            red: ThemeColor::from_string("#bf616a").unwrap(),
321            green: ThemeColor::from_string("#a3be8c").unwrap(),
322            yellow: ThemeColor::from_string("#ebcb8b").unwrap(),
323            blue: ThemeColor::from_string("#81a1c1").unwrap(),
324            purple: ThemeColor::from_string("#b48ead").unwrap(),
325            aqua: ThemeColor::from_string("#88c0d0").unwrap(),
326            orange: ThemeColor::from_string("#d08770").unwrap(),
327            fg_secondary: ThemeColor::from_string("#d8dee9").unwrap(),
328            gray: ThemeColor::from_string("#4c566a").unwrap(),
329            selection_fg: ThemeColor::from_string("#eceff4").unwrap(),
330            border_dim: ThemeColor::from_string("#434c5e").unwrap(),
331            focus_border: ThemeColor::from_string("#a3be8c").unwrap(),
332            accent: ThemeColor::from_string("#88c0d0").unwrap(),
333            color_directory: ThemeColor::from_string("#81a1c1").unwrap(),
334            color_journal_date: ThemeColor::from_string("#8fbcbb").unwrap(),
335            color_search_match: ThemeColor::from_string("#a3be8c").unwrap(),
336            color_tag: ThemeColor::from_string("#d08770").unwrap(),
337            blockquote_bar: ThemeColor::from_string("#88c0d0").unwrap(),
338            code_bg: ThemeColor::from_string("#3b4252").unwrap(),
339            color_replace_preview: ThemeColor::from_string("#4a3f52").unwrap(),
340        }
341    }
342
343    pub fn dracula() -> Self {
344        Theme {
345            name: "Dracula".to_string(),
346            bg: ThemeColor::from_string("#282a36").unwrap(),
347            bg_hard: ThemeColor::from_string("#191a21").unwrap(),
348            bg_soft: ThemeColor::from_string("#44475a").unwrap(),
349            bg_panel: ThemeColor::from_string("#21222c").unwrap(),
350            selection_bg: ThemeColor::from_string("#44475a").unwrap(),
351            fg: ThemeColor::from_string("#f8f8f2").unwrap(),
352            fg_bright: ThemeColor::from_string("#ffffff").unwrap(),
353            cursor: ThemeColor::from_string("#f8f8f2").unwrap(),
354            red: ThemeColor::from_string("#ff5555").unwrap(),
355            green: ThemeColor::from_string("#50fa7b").unwrap(),
356            yellow: ThemeColor::from_string("#f1fa8c").unwrap(),
357            blue: ThemeColor::from_string("#8be9fd").unwrap(),
358            purple: ThemeColor::from_string("#bd93f9").unwrap(),
359            aqua: ThemeColor::from_string("#8be9fd").unwrap(),
360            orange: ThemeColor::from_string("#ffb86c").unwrap(),
361            fg_secondary: ThemeColor::from_string("#bfbfbf").unwrap(),
362            gray: ThemeColor::from_string("#6272a4").unwrap(),
363            selection_fg: ThemeColor::from_string("#f8f8f2").unwrap(),
364            border_dim: ThemeColor::from_string("#44475a").unwrap(),
365            focus_border: ThemeColor::from_string("#50fa7b").unwrap(),
366            accent: ThemeColor::from_string("#bd93f9").unwrap(),
367            color_directory: ThemeColor::from_string("#8be9fd").unwrap(),
368            color_journal_date: ThemeColor::from_string("#50fa7b").unwrap(),
369            color_search_match: ThemeColor::from_string("#f1fa8c").unwrap(),
370            color_tag: ThemeColor::from_string("#ffb86c").unwrap(),
371            blockquote_bar: ThemeColor::from_string("#bd93f9").unwrap(),
372            code_bg: ThemeColor::from_string("#21222c").unwrap(),
373            color_replace_preview: ThemeColor::from_string("#453a5e").unwrap(),
374        }
375    }
376
377    /// Alucard is Dracula's official light variant.
378    pub fn alucard() -> Self {
379        Theme {
380            name: "Alucard".to_string(),
381            bg: ThemeColor::from_string("#fffbeb").unwrap(),
382            bg_hard: ThemeColor::from_string("#f2eeda").unwrap(),
383            bg_soft: ThemeColor::from_string("#e2deca").unwrap(),
384            bg_panel: ThemeColor::from_string("#f2eeda").unwrap(),
385            selection_bg: ThemeColor::from_string("#cfcfde").unwrap(),
386            fg: ThemeColor::from_string("#1f1f1f").unwrap(),
387            fg_bright: ThemeColor::from_string("#000000").unwrap(),
388            cursor: ThemeColor::from_string("#1f1f1f").unwrap(),
389            red: ThemeColor::from_string("#cb3a2a").unwrap(),
390            green: ThemeColor::from_string("#14710a").unwrap(),
391            yellow: ThemeColor::from_string("#846e15").unwrap(),
392            blue: ThemeColor::from_string("#036a96").unwrap(),
393            purple: ThemeColor::from_string("#644ac9").unwrap(),
394            aqua: ThemeColor::from_string("#036a96").unwrap(),
395            orange: ThemeColor::from_string("#a34d14").unwrap(),
396            fg_secondary: ThemeColor::from_string("#6c664b").unwrap(),
397            gray: ThemeColor::from_string("#a8a27f").unwrap(),
398            selection_fg: ThemeColor::from_string("#1f1f1f").unwrap(),
399            border_dim: ThemeColor::from_string("#e2deca").unwrap(),
400            focus_border: ThemeColor::from_string("#14710a").unwrap(),
401            accent: ThemeColor::from_string("#644ac9").unwrap(),
402            color_directory: ThemeColor::from_string("#036a96").unwrap(),
403            color_journal_date: ThemeColor::from_string("#14710a").unwrap(),
404            color_search_match: ThemeColor::from_string("#846e15").unwrap(),
405            color_tag: ThemeColor::from_string("#a34d14").unwrap(),
406            blockquote_bar: ThemeColor::from_string("#644ac9").unwrap(),
407            code_bg: ThemeColor::from_string("#f2eeda").unwrap(),
408            color_replace_preview: ThemeColor::from_string("#e4dcf0").unwrap(),
409        }
410    }
411
412    pub fn one_dark() -> Self {
413        Theme {
414            name: "One Dark".to_string(),
415            bg: ThemeColor::from_string("#282c34").unwrap(),
416            bg_hard: ThemeColor::from_string("#21252b").unwrap(),
417            bg_soft: ThemeColor::from_string("#3e4451").unwrap(),
418            bg_panel: ThemeColor::from_string("#21252b").unwrap(),
419            selection_bg: ThemeColor::from_string("#3e4451").unwrap(),
420            fg: ThemeColor::from_string("#abb2bf").unwrap(),
421            fg_bright: ThemeColor::from_string("#c8ccd4").unwrap(),
422            cursor: ThemeColor::from_string("#528bff").unwrap(),
423            red: ThemeColor::from_string("#e06c75").unwrap(),
424            green: ThemeColor::from_string("#98c379").unwrap(),
425            yellow: ThemeColor::from_string("#e5c07b").unwrap(),
426            blue: ThemeColor::from_string("#61afef").unwrap(),
427            purple: ThemeColor::from_string("#c678dd").unwrap(),
428            aqua: ThemeColor::from_string("#56b6c2").unwrap(),
429            orange: ThemeColor::from_string("#d19a66").unwrap(),
430            fg_secondary: ThemeColor::from_string("#828997").unwrap(),
431            gray: ThemeColor::from_string("#5c6370").unwrap(),
432            selection_fg: ThemeColor::from_string("#abb2bf").unwrap(),
433            border_dim: ThemeColor::from_string("#3e4451").unwrap(),
434            focus_border: ThemeColor::from_string("#98c379").unwrap(),
435            accent: ThemeColor::from_string("#61afef").unwrap(),
436            color_directory: ThemeColor::from_string("#56b6c2").unwrap(),
437            color_journal_date: ThemeColor::from_string("#98c379").unwrap(),
438            color_search_match: ThemeColor::from_string("#e5c07b").unwrap(),
439            color_tag: ThemeColor::from_string("#d19a66").unwrap(),
440            blockquote_bar: ThemeColor::from_string("#61afef").unwrap(),
441            code_bg: ThemeColor::from_string("#21252b").unwrap(),
442            color_replace_preview: ThemeColor::from_string("#3a2f4a").unwrap(),
443        }
444    }
445
446    pub fn one_light() -> Self {
447        Theme {
448            name: "One Light".to_string(),
449            bg: ThemeColor::from_string("#fafafa").unwrap(),
450            bg_hard: ThemeColor::from_string("#f0f0f1").unwrap(),
451            bg_soft: ThemeColor::from_string("#e5e5e6").unwrap(),
452            bg_panel: ThemeColor::from_string("#f0f0f1").unwrap(),
453            selection_bg: ThemeColor::from_string("#e5e5e6").unwrap(),
454            fg: ThemeColor::from_string("#383a42").unwrap(),
455            fg_bright: ThemeColor::from_string("#232324").unwrap(),
456            cursor: ThemeColor::from_string("#383a42").unwrap(),
457            red: ThemeColor::from_string("#e45649").unwrap(),
458            green: ThemeColor::from_string("#50a14f").unwrap(),
459            yellow: ThemeColor::from_string("#c18401").unwrap(),
460            blue: ThemeColor::from_string("#4078f2").unwrap(),
461            purple: ThemeColor::from_string("#a626a4").unwrap(),
462            aqua: ThemeColor::from_string("#0184bc").unwrap(),
463            orange: ThemeColor::from_string("#986801").unwrap(),
464            fg_secondary: ThemeColor::from_string("#696c77").unwrap(),
465            gray: ThemeColor::from_string("#a0a1a7").unwrap(),
466            selection_fg: ThemeColor::from_string("#383a42").unwrap(),
467            border_dim: ThemeColor::from_string("#dbdbdc").unwrap(),
468            focus_border: ThemeColor::from_string("#50a14f").unwrap(),
469            accent: ThemeColor::from_string("#4078f2").unwrap(),
470            color_directory: ThemeColor::from_string("#0184bc").unwrap(),
471            color_journal_date: ThemeColor::from_string("#50a14f").unwrap(),
472            color_search_match: ThemeColor::from_string("#c18401").unwrap(),
473            color_tag: ThemeColor::from_string("#986801").unwrap(),
474            blockquote_bar: ThemeColor::from_string("#4078f2").unwrap(),
475            code_bg: ThemeColor::from_string("#f0f0f1").unwrap(),
476            color_replace_preview: ThemeColor::from_string("#e3dcf0").unwrap(),
477        }
478    }
479
480    pub fn monokai() -> Self {
481        Theme {
482            name: "Monokai".to_string(),
483            bg: ThemeColor::from_string("#272822").unwrap(),
484            bg_hard: ThemeColor::from_string("#1e1f1c").unwrap(),
485            bg_soft: ThemeColor::from_string("#3e3d32").unwrap(),
486            bg_panel: ThemeColor::from_string("#1e1f1c").unwrap(),
487            selection_bg: ThemeColor::from_string("#49483e").unwrap(),
488            fg: ThemeColor::from_string("#f8f8f2").unwrap(),
489            fg_bright: ThemeColor::from_string("#f8f8f0").unwrap(),
490            cursor: ThemeColor::from_string("#f8f8f0").unwrap(),
491            red: ThemeColor::from_string("#f92672").unwrap(),
492            green: ThemeColor::from_string("#a6e22e").unwrap(),
493            yellow: ThemeColor::from_string("#e6db74").unwrap(),
494            blue: ThemeColor::from_string("#66d9ef").unwrap(),
495            purple: ThemeColor::from_string("#ae81ff").unwrap(),
496            aqua: ThemeColor::from_string("#66d9ef").unwrap(),
497            orange: ThemeColor::from_string("#fd971f").unwrap(),
498            fg_secondary: ThemeColor::from_string("#a59f85").unwrap(),
499            gray: ThemeColor::from_string("#75715e").unwrap(),
500            selection_fg: ThemeColor::from_string("#f8f8f2").unwrap(),
501            border_dim: ThemeColor::from_string("#49483e").unwrap(),
502            focus_border: ThemeColor::from_string("#a6e22e").unwrap(),
503            accent: ThemeColor::from_string("#f92672").unwrap(),
504            color_directory: ThemeColor::from_string("#66d9ef").unwrap(),
505            color_journal_date: ThemeColor::from_string("#a6e22e").unwrap(),
506            color_search_match: ThemeColor::from_string("#e6db74").unwrap(),
507            color_tag: ThemeColor::from_string("#fd971f").unwrap(),
508            blockquote_bar: ThemeColor::from_string("#f92672").unwrap(),
509            code_bg: ThemeColor::from_string("#1e1f1c").unwrap(),
510            color_replace_preview: ThemeColor::from_string("#3d3350").unwrap(),
511        }
512    }
513
514    pub fn everforest_dark() -> Self {
515        Theme {
516            name: "Everforest Dark".to_string(),
517            bg: ThemeColor::from_string("#2d353b").unwrap(),
518            bg_hard: ThemeColor::from_string("#232a2e").unwrap(),
519            bg_soft: ThemeColor::from_string("#343f44").unwrap(),
520            bg_panel: ThemeColor::from_string("#232a2e").unwrap(),
521            selection_bg: ThemeColor::from_string("#475258").unwrap(),
522            fg: ThemeColor::from_string("#d3c6aa").unwrap(),
523            fg_bright: ThemeColor::from_string("#d3c6aa").unwrap(),
524            cursor: ThemeColor::from_string("#d3c6aa").unwrap(),
525            red: ThemeColor::from_string("#e67e80").unwrap(),
526            green: ThemeColor::from_string("#a7c080").unwrap(),
527            yellow: ThemeColor::from_string("#dbbc7f").unwrap(),
528            blue: ThemeColor::from_string("#7fbbb3").unwrap(),
529            purple: ThemeColor::from_string("#d699b6").unwrap(),
530            aqua: ThemeColor::from_string("#83c092").unwrap(),
531            orange: ThemeColor::from_string("#e69875").unwrap(),
532            fg_secondary: ThemeColor::from_string("#9da9a0").unwrap(),
533            gray: ThemeColor::from_string("#7a8478").unwrap(),
534            selection_fg: ThemeColor::from_string("#d3c6aa").unwrap(),
535            border_dim: ThemeColor::from_string("#3d484d").unwrap(),
536            focus_border: ThemeColor::from_string("#a7c080").unwrap(),
537            accent: ThemeColor::from_string("#a7c080").unwrap(),
538            color_directory: ThemeColor::from_string("#7fbbb3").unwrap(),
539            color_journal_date: ThemeColor::from_string("#83c092").unwrap(),
540            color_search_match: ThemeColor::from_string("#dbbc7f").unwrap(),
541            color_tag: ThemeColor::from_string("#e69875").unwrap(),
542            blockquote_bar: ThemeColor::from_string("#a7c080").unwrap(),
543            code_bg: ThemeColor::from_string("#232a2e").unwrap(),
544            color_replace_preview: ThemeColor::from_string("#3d3548").unwrap(),
545        }
546    }
547
548    pub fn everforest_light() -> Self {
549        Theme {
550            name: "Everforest Light".to_string(),
551            bg: ThemeColor::from_string("#fdf6e3").unwrap(),
552            bg_hard: ThemeColor::from_string("#efebd4").unwrap(),
553            bg_soft: ThemeColor::from_string("#f4f0d9").unwrap(),
554            bg_panel: ThemeColor::from_string("#f4f0d9").unwrap(),
555            selection_bg: ThemeColor::from_string("#e6e2cc").unwrap(),
556            fg: ThemeColor::from_string("#5c6a72").unwrap(),
557            fg_bright: ThemeColor::from_string("#5c6a72").unwrap(),
558            cursor: ThemeColor::from_string("#5c6a72").unwrap(),
559            red: ThemeColor::from_string("#f85552").unwrap(),
560            green: ThemeColor::from_string("#8da101").unwrap(),
561            yellow: ThemeColor::from_string("#dfa000").unwrap(),
562            blue: ThemeColor::from_string("#3a94c5").unwrap(),
563            purple: ThemeColor::from_string("#df69ba").unwrap(),
564            aqua: ThemeColor::from_string("#35a77c").unwrap(),
565            orange: ThemeColor::from_string("#f57d26").unwrap(),
566            fg_secondary: ThemeColor::from_string("#829181").unwrap(),
567            gray: ThemeColor::from_string("#a6b0a0").unwrap(),
568            selection_fg: ThemeColor::from_string("#5c6a72").unwrap(),
569            border_dim: ThemeColor::from_string("#e0dcc7").unwrap(),
570            focus_border: ThemeColor::from_string("#8da101").unwrap(),
571            accent: ThemeColor::from_string("#8da101").unwrap(),
572            color_directory: ThemeColor::from_string("#3a94c5").unwrap(),
573            color_journal_date: ThemeColor::from_string("#35a77c").unwrap(),
574            color_search_match: ThemeColor::from_string("#dfa000").unwrap(),
575            color_tag: ThemeColor::from_string("#f57d26").unwrap(),
576            blockquote_bar: ThemeColor::from_string("#8da101").unwrap(),
577            code_bg: ThemeColor::from_string("#f4f0d9").unwrap(),
578            color_replace_preview: ThemeColor::from_string("#e6dcea").unwrap(),
579        }
580    }
581
582    pub fn rose_pine() -> Self {
583        Theme {
584            name: "Rosé Pine".to_string(),
585            bg: ThemeColor::from_string("#191724").unwrap(),
586            bg_hard: ThemeColor::from_string("#1f1d2e").unwrap(),
587            bg_soft: ThemeColor::from_string("#26233a").unwrap(),
588            bg_panel: ThemeColor::from_string("#1f1d2e").unwrap(),
589            selection_bg: ThemeColor::from_string("#403d52").unwrap(),
590            fg: ThemeColor::from_string("#e0def4").unwrap(),
591            fg_bright: ThemeColor::from_string("#e0def4").unwrap(),
592            cursor: ThemeColor::from_string("#e0def4").unwrap(),
593            red: ThemeColor::from_string("#eb6f92").unwrap(),
594            green: ThemeColor::from_string("#31748f").unwrap(),
595            yellow: ThemeColor::from_string("#f6c177").unwrap(),
596            blue: ThemeColor::from_string("#9ccfd8").unwrap(),
597            purple: ThemeColor::from_string("#c4a7e7").unwrap(),
598            aqua: ThemeColor::from_string("#9ccfd8").unwrap(),
599            orange: ThemeColor::from_string("#ebbcba").unwrap(),
600            fg_secondary: ThemeColor::from_string("#908caa").unwrap(),
601            gray: ThemeColor::from_string("#6e6a86").unwrap(),
602            selection_fg: ThemeColor::from_string("#e0def4").unwrap(),
603            border_dim: ThemeColor::from_string("#26233a").unwrap(),
604            focus_border: ThemeColor::from_string("#31748f").unwrap(),
605            accent: ThemeColor::from_string("#c4a7e7").unwrap(),
606            color_directory: ThemeColor::from_string("#9ccfd8").unwrap(),
607            color_journal_date: ThemeColor::from_string("#31748f").unwrap(),
608            color_search_match: ThemeColor::from_string("#f6c177").unwrap(),
609            color_tag: ThemeColor::from_string("#ebbcba").unwrap(),
610            blockquote_bar: ThemeColor::from_string("#c4a7e7").unwrap(),
611            code_bg: ThemeColor::from_string("#1f1d2e").unwrap(),
612            color_replace_preview: ThemeColor::from_string("#403a5c").unwrap(),
613        }
614    }
615
616    /// Dawn is Rosé Pine's light variant. Note `bg_panel` (surface) is
617    /// lighter than `bg` (base) — that is the official palette layering.
618    pub fn rose_pine_dawn() -> Self {
619        Theme {
620            name: "Rosé Pine Dawn".to_string(),
621            bg: ThemeColor::from_string("#faf4ed").unwrap(),
622            bg_hard: ThemeColor::from_string("#fffaf3").unwrap(),
623            bg_soft: ThemeColor::from_string("#f2e9e1").unwrap(),
624            bg_panel: ThemeColor::from_string("#fffaf3").unwrap(),
625            selection_bg: ThemeColor::from_string("#dfdad9").unwrap(),
626            fg: ThemeColor::from_string("#575279").unwrap(),
627            fg_bright: ThemeColor::from_string("#575279").unwrap(),
628            cursor: ThemeColor::from_string("#575279").unwrap(),
629            red: ThemeColor::from_string("#b4637a").unwrap(),
630            green: ThemeColor::from_string("#286983").unwrap(),
631            yellow: ThemeColor::from_string("#ea9d34").unwrap(),
632            blue: ThemeColor::from_string("#56949f").unwrap(),
633            purple: ThemeColor::from_string("#907aa9").unwrap(),
634            aqua: ThemeColor::from_string("#56949f").unwrap(),
635            orange: ThemeColor::from_string("#d7827e").unwrap(),
636            fg_secondary: ThemeColor::from_string("#797593").unwrap(),
637            gray: ThemeColor::from_string("#9893a5").unwrap(),
638            selection_fg: ThemeColor::from_string("#575279").unwrap(),
639            border_dim: ThemeColor::from_string("#f2e9e1").unwrap(),
640            focus_border: ThemeColor::from_string("#286983").unwrap(),
641            accent: ThemeColor::from_string("#907aa9").unwrap(),
642            color_directory: ThemeColor::from_string("#56949f").unwrap(),
643            color_journal_date: ThemeColor::from_string("#286983").unwrap(),
644            color_search_match: ThemeColor::from_string("#ea9d34").unwrap(),
645            color_tag: ThemeColor::from_string("#d7827e").unwrap(),
646            blockquote_bar: ThemeColor::from_string("#907aa9").unwrap(),
647            code_bg: ThemeColor::from_string("#fffaf3").unwrap(),
648            color_replace_preview: ThemeColor::from_string("#eadff0").unwrap(),
649        }
650    }
651
652    pub fn kanagawa_wave() -> Self {
653        Theme {
654            name: "Kanagawa Wave".to_string(),
655            bg: ThemeColor::from_string("#1f1f28").unwrap(),
656            bg_hard: ThemeColor::from_string("#16161d").unwrap(),
657            bg_soft: ThemeColor::from_string("#2a2a37").unwrap(),
658            bg_panel: ThemeColor::from_string("#16161d").unwrap(),
659            selection_bg: ThemeColor::from_string("#2d4f67").unwrap(),
660            fg: ThemeColor::from_string("#dcd7ba").unwrap(),
661            fg_bright: ThemeColor::from_string("#dcd7ba").unwrap(),
662            cursor: ThemeColor::from_string("#c8c093").unwrap(),
663            red: ThemeColor::from_string("#c34043").unwrap(),
664            green: ThemeColor::from_string("#98bb6c").unwrap(),
665            yellow: ThemeColor::from_string("#e6c384").unwrap(),
666            blue: ThemeColor::from_string("#7e9cd8").unwrap(),
667            purple: ThemeColor::from_string("#957fb8").unwrap(),
668            aqua: ThemeColor::from_string("#7aa89f").unwrap(),
669            orange: ThemeColor::from_string("#ffa066").unwrap(),
670            fg_secondary: ThemeColor::from_string("#c8c093").unwrap(),
671            gray: ThemeColor::from_string("#727169").unwrap(),
672            selection_fg: ThemeColor::from_string("#dcd7ba").unwrap(),
673            border_dim: ThemeColor::from_string("#54546d").unwrap(),
674            focus_border: ThemeColor::from_string("#98bb6c").unwrap(),
675            accent: ThemeColor::from_string("#7e9cd8").unwrap(),
676            color_directory: ThemeColor::from_string("#7fb4ca").unwrap(),
677            color_journal_date: ThemeColor::from_string("#7aa89f").unwrap(),
678            color_search_match: ThemeColor::from_string("#98bb6c").unwrap(),
679            color_tag: ThemeColor::from_string("#ffa066").unwrap(),
680            blockquote_bar: ThemeColor::from_string("#7e9cd8").unwrap(),
681            code_bg: ThemeColor::from_string("#16161d").unwrap(),
682            color_replace_preview: ThemeColor::from_string("#3a3450").unwrap(),
683        }
684    }
685
686    /// Lotus is Kanagawa's light variant.
687    pub fn kanagawa_lotus() -> Self {
688        Theme {
689            name: "Kanagawa Lotus".to_string(),
690            bg: ThemeColor::from_string("#f2ecbc").unwrap(),
691            bg_hard: ThemeColor::from_string("#e5ddb0").unwrap(),
692            bg_soft: ThemeColor::from_string("#e7dba0").unwrap(),
693            bg_panel: ThemeColor::from_string("#e5ddb0").unwrap(),
694            selection_bg: ThemeColor::from_string("#c9cbd1").unwrap(),
695            fg: ThemeColor::from_string("#545464").unwrap(),
696            fg_bright: ThemeColor::from_string("#545464").unwrap(),
697            cursor: ThemeColor::from_string("#545464").unwrap(),
698            red: ThemeColor::from_string("#c84053").unwrap(),
699            green: ThemeColor::from_string("#6f894e").unwrap(),
700            yellow: ThemeColor::from_string("#de9800").unwrap(),
701            blue: ThemeColor::from_string("#4d699b").unwrap(),
702            purple: ThemeColor::from_string("#766b90").unwrap(),
703            aqua: ThemeColor::from_string("#597b75").unwrap(),
704            orange: ThemeColor::from_string("#cc6d00").unwrap(),
705            fg_secondary: ThemeColor::from_string("#716e61").unwrap(),
706            gray: ThemeColor::from_string("#8a8980").unwrap(),
707            selection_fg: ThemeColor::from_string("#545464").unwrap(),
708            border_dim: ThemeColor::from_string("#d5cea3").unwrap(),
709            focus_border: ThemeColor::from_string("#6f894e").unwrap(),
710            accent: ThemeColor::from_string("#4d699b").unwrap(),
711            color_directory: ThemeColor::from_string("#4e8ca2").unwrap(),
712            color_journal_date: ThemeColor::from_string("#597b75").unwrap(),
713            color_search_match: ThemeColor::from_string("#6f894e").unwrap(),
714            color_tag: ThemeColor::from_string("#cc6d00").unwrap(),
715            blockquote_bar: ThemeColor::from_string("#4d699b").unwrap(),
716            code_bg: ThemeColor::from_string("#e5ddb0").unwrap(),
717            color_replace_preview: ThemeColor::from_string("#ded3e0").unwrap(),
718        }
719    }
720
721    /// Uses the terminal's 16 ANSI colors so the theme adapts to whatever
722    /// palette the user has configured in their terminal emulator. Works for
723    /// both light and dark terminal palettes because backgrounds and primary
724    /// foregrounds use `Reset` (the terminal's defaults) and accents are
725    /// chromatic ANSI slots whose hue is stable across palettes.
726    pub fn ansi() -> Self {
727        Theme {
728            name: "ANSI".to_string(),
729            bg: ThemeColor::Reset,
730            bg_hard: ThemeColor::Ansi(0), // black
731            bg_soft: ThemeColor::Ansi(8), // bright black
732            bg_panel: ThemeColor::Reset,
733            selection_bg: ThemeColor::Ansi(4), // blue
734            fg: ThemeColor::Reset,
735            fg_bright: ThemeColor::Ansi(15), // bright white
736            cursor: ThemeColor::Reset,
737            red: ThemeColor::Ansi(9),                 // bright red
738            green: ThemeColor::Ansi(10),              // bright green
739            yellow: ThemeColor::Ansi(11),             // bright yellow
740            blue: ThemeColor::Ansi(12),               // bright blue
741            purple: ThemeColor::Ansi(13),             // bright magenta
742            aqua: ThemeColor::Ansi(14),               // bright cyan
743            orange: ThemeColor::Ansi(3),              // yellow (closest 16-color slot)
744            fg_secondary: ThemeColor::Ansi(7),        // white
745            gray: ThemeColor::Ansi(8),                // bright black
746            selection_fg: ThemeColor::Ansi(15),       // bright white
747            border_dim: ThemeColor::Ansi(8),          // bright black
748            focus_border: ThemeColor::Ansi(10),       // bright green
749            accent: ThemeColor::Ansi(6),              // cyan
750            color_directory: ThemeColor::Ansi(12),    // bright blue
751            color_journal_date: ThemeColor::Ansi(10), // bright green
752            color_search_match: ThemeColor::Ansi(11), // bright yellow
753            color_tag: ThemeColor::Ansi(3),           // yellow
754            blockquote_bar: ThemeColor::Ansi(6),      // cyan (accent)
755            // Bright-black (gray) — a subtle code-block box that stays visible
756            // on both light and dark terminal palettes. `Reset` would equal the
757            // editor background and render no box at all.
758            code_bg: ThemeColor::Ansi(8),
759            color_replace_preview: ThemeColor::Ansi(5), // magenta
760        }
761    }
762}
763
764#[cfg(test)]
765mod tests {
766    use super::*;
767
768    #[test]
769    fn every_builtin_theme_has_a_visible_code_bg() {
770        // `Reset` equals the editor background, so a code block would render no
771        // box at all (the ANSI-theme regression). Every built-in must use a
772        // real color for `code_bg`.
773        for theme in Theme::builtins() {
774            assert_ne!(
775                theme.code_bg,
776                ThemeColor::Reset,
777                "theme {:?} has code_bg = Reset → invisible code box",
778                theme.name
779            );
780        }
781    }
782}