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