Skip to main content

tui_nuances/
builtin.rs

1//! Built-in named themes and lookup / cycling helpers.
2//!
3//! Cycling order of [`Theme::all`]: `default` first, then runs of 20 dark
4//! themes alternating with runs of 20 light themes (so light themes show up
5//! early and the cycle does not flash between light and dark on every step).
6//! Inside a run the order follows the theme table; once the light themes are
7//! used up the remaining dark ones follow.
8
9use crate::theme::{Spec, Theme, rgb};
10use ratatui::style::Color;
11
12/// Themes per run in the cycle: this many dark ones, then this many light ones.
13const CYCLE_BLOCK: usize = 20;
14
15named_themes! {
16    default_light, "default-light", "Default Light (light, from gitkraft)." =>
17    [0xfafaff, 0x1e2332, 0x828ca0, 0xebeef8, 0x008cdc, 0xff641e, 0x1ea050, 0xc88c00, 0xd23232, 0xff641e],
18    [0x008cdc, 0x1ea050, 0xd23232, 0xc88c00, 0xff641e, 0x8c50c8, 0x009696, 0xbe3c78];
19    catppuccin_mocha, "catppuccin-mocha", "Catppuccin Mocha (dark)." =>
20    [0x1e1e2e, 0xcdd6f4, 0x9399b2, 0x313244, 0x89b4fa, 0xcba6f7, 0xa6e3a1, 0xf9e2af, 0xf38ba8, 0x89dceb],
21    [0x89b4fa, 0xf9e2af, 0xcba6f7, 0xa6e3a1, 0xf38ba8, 0x94e2d5, 0xfab387, 0xf5c2e7];
22    catppuccin_latte, "catppuccin-latte", "Catppuccin Latte (light)." =>
23    [0xeff1f5, 0x4c4f69, 0x7c7f93, 0xccd0da, 0x1e66f5, 0x8839ef, 0x40a02b, 0xdf8e1d, 0xd20f39, 0x04a5e5],
24    [0x1e66f5, 0xdf8e1d, 0x8839ef, 0x40a02b, 0xd20f39, 0x179299, 0xfe640b, 0xea76cb];
25    solarized_dark, "solarized-dark", "Solarized Dark." =>
26    [0x002b36, 0x93a1a1, 0x839496, 0x073642, 0x268bd2, 0x6c71c4, 0x859900, 0xb58900, 0xdc322f, 0x2aa198],
27    [0x268bd2, 0xb58900, 0x6c71c4, 0x859900, 0xdc322f, 0x2aa198, 0xcb4b16, 0xd33682];
28    solarized_light, "solarized-light", "Solarized Light." =>
29    [0xfdf6e3, 0x586e75, 0x657b83, 0xeee8d5, 0x268bd2, 0x6c71c4, 0x859900, 0xb58900, 0xdc322f, 0x2aa198],
30    [0x268bd2, 0xb58900, 0x6c71c4, 0x859900, 0xdc322f, 0x2aa198, 0xcb4b16, 0xd33682];
31    github_dark, "github-dark", "Github Dark." =>
32    [0x0d1117, 0xc9d1d9, 0x8b949e, 0x1f242a, 0x79c0ff, 0xd2a8ff, 0x7ee787, 0xe3b341, 0xff7b72, 0xa5d6ff],
33    [0x79c0ff, 0xe3b341, 0xd2a8ff, 0x7ee787, 0xff7b72, 0xa5d6ff, 0xffa657, 0xd2a8ff];
34    github_light, "github-light", "Github Light." =>
35    [0xffffff, 0x24292f, 0x6e7781, 0xe9e9ea, 0x0969da, 0x8250df, 0x1a7f37, 0x9a6700, 0xcf222e, 0x1b7c83],
36    [0x0969da, 0x9a6700, 0x8250df, 0x1a7f37, 0xcf222e, 0x1b7c83, 0xbc4c00, 0x8250df];
37    gruvbox, "gruvbox", "Gruvbox (dark, warm retro)." =>
38    [0x282828, 0xebdbb2, 0xa89984, 0x3c3836, 0x83a598, 0xd3869b, 0xb8bb26, 0xfabd2f, 0xfb4934, 0x8ec07c],
39    [0x83a598, 0xfabd2f, 0xb8bb26, 0xd3869b, 0xfb4934, 0x8ec07c, 0xfe8019, 0xebdbb2];
40    gruvbox_light, "gruvbox-light", "Gruvbox Light (light, from gitkraft)." =>
41    [0xfbf1c7, 0x3c3836, 0x928374, 0xd5c4a1, 0xd65d0e, 0xd79921, 0x79740e, 0xd79921, 0xd65d0e, 0xd79921],
42    [0xd65d0e, 0x79740e, 0xcc241d, 0xd79921, 0x458588, 0xb16286, 0x689d6a, 0x076678];
43    tokyo_night, "tokyo-night", "Tokyo Night (dark)." =>
44    [0x1a1b26, 0xc0caf5, 0x737aa2, 0x292e42, 0x7aa2f7, 0xbb9af7, 0x9ece6a, 0xe0af68, 0xf7768e, 0x7dcfff],
45    [0x7aa2f7, 0xe0af68, 0xbb9af7, 0x9ece6a, 0xf7768e, 0x7dcfff, 0xff9e64, 0x73daca];
46    tokyo_night_day, "tokyo-night-day", "Tokyo Night Day." =>
47    [0xe1e2e7, 0x3760bf, 0x848cb5, 0xd0d5e3, 0x2e7de9, 0x9854f1, 0x587539, 0x8c6c3e, 0xf52a65, 0x007197],
48    [0x2e7de9, 0x8c6c3e, 0x9854f1, 0x587539, 0xf52a65, 0x007197, 0xb15c00, 0x7847bd];
49    rose_pine, "rose-pine", "Rosé Pine (dark)." =>
50    [0x191724, 0xe0def4, 0x908caa, 0x1f1d2e, 0xc4a7e7, 0xebbcba, 0x9ccfd8, 0xf6c177, 0xeb6f92, 0x31748f],
51    [0xc4a7e7, 0xf6c177, 0xebbcba, 0x9ccfd8, 0xeb6f92, 0x31748f, 0xea9a97, 0xe0def4];
52    rose_pine_dawn, "rose-pine-dawn", "Rose Pine Dawn (light, from gitkraft)." =>
53    [0xfaf4ed, 0x575279, 0x9893a5, 0xf2e9dd, 0x907aa9, 0x56949f, 0x286983, 0xea9d34, 0xb4637a, 0x56949f],
54    [0x907aa9, 0x286983, 0xb4637a, 0xea9d34, 0x56949f, 0xd7827e, 0x575279, 0x9893a5];
55    one_dark, "one-dark", "One Dark (Atom)." =>
56    [0x282c34, 0xabb2bf, 0x7f848e, 0x3e4451, 0x61afef, 0xc678dd, 0x98c379, 0xe5c07b, 0xe06c75, 0x56b6c2],
57    [0x61afef, 0xe5c07b, 0xc678dd, 0x98c379, 0xe06c75, 0x56b6c2, 0xd19a66, 0xabb2bf];
58    atom_one_light, "atom-one-light", "Atom One Light (light, from gitkraft)." =>
59    [0xf9f9f9, 0x2a2c33, 0x767676, 0xededed, 0x2f5af3, 0x2f5af3, 0x3f953a, 0xd2b67c, 0xde3e35, 0x2f5af3],
60    [0x2f5af3, 0x3f953a, 0xde3e35, 0xd2b67c, 0xa626a4, 0x0184bc, 0x2a2c33, 0xb4b4b4];
61    ayu_dark, "ayu-dark", "Ayu Dark." =>
62    [0x0b0e14, 0xbfbdb6, 0x565b66, 0x1d1f24, 0x59c2ff, 0xd2a6ff, 0xaad94c, 0xe6b450, 0xf26d78, 0x95e6cb],
63    [0x59c2ff, 0xe6b450, 0xd2a6ff, 0xaad94c, 0xf26d78, 0x95e6cb, 0xff8f40, 0xd2a6ff];
64    ayu_light, "ayu-light", "Ayu Light." =>
65    [0xfafafa, 0x5c6166, 0xadaeb1, 0xeaeaeb, 0x399ee6, 0xa37acc, 0x86b300, 0xf2ae49, 0xe65050, 0x4cbf99],
66    [0x399ee6, 0xf2ae49, 0xa37acc, 0x86b300, 0xe65050, 0x4cbf99, 0xfa8d3e, 0xa37acc];
67    everforest_dark, "everforest-dark", "Everforest Dark (dark, from gitkraft)." =>
68    [0x1e2326, 0xd3c6aa, 0x7a8478, 0x2a3032, 0xa7c080, 0x7fbbb3, 0xa7c080, 0xdbbc7f, 0xe67e80, 0x7fbbb3],
69    [0xa7c080, 0x7fbbb3, 0xe67e80, 0xdbbc7f, 0xd699b6, 0xd3c6aa, 0xa6b0a0, 0x7a8478];
70    everforest_light, "everforest-light", "Everforest Light." =>
71    [0xfdf6e3, 0x5c6a72, 0xa6b0a0, 0xece8d7, 0x3a94c5, 0xdf69ba, 0x8da101, 0xdfa000, 0xf85552, 0x35a77c],
72    [0x3a94c5, 0xdfa000, 0xdf69ba, 0x8da101, 0xf85552, 0x35a77c, 0xf57d26, 0xdf69ba];
73    nightfox, "nightfox", "Nightfox." =>
74    [0x192330, 0xcdcecf, 0x738091, 0x2b343f, 0x719cd6, 0x9d79d6, 0x81b29a, 0xdbc074, 0xc94f6d, 0x63cdcf],
75    [0x719cd6, 0xdbc074, 0x9d79d6, 0x81b29a, 0xc94f6d, 0x63cdcf, 0xf4a261, 0x9d79d6];
76    dayfox, "dayfox", "Dayfox (light)." =>
77    [0xf6f2ee, 0x3d2b5a, 0x837a72, 0xe4dcd4, 0x2848a9, 0x6e33ce, 0x396847, 0xac5402, 0xa5222f, 0x287980],
78    [0x2848a9, 0xac5402, 0x6e33ce, 0x396847, 0xa5222f, 0x287980, 0x955f61, 0xa440b5];
79    kanagawa_wave, "kanagawa-wave", "Kanagawa Wave (dark, from gitkraft)." =>
80    [0x16161e, 0xdcd7ba, 0x727169, 0x2a2a37, 0xd27e99, 0x7e9cd8, 0x76946a, 0xdca561, 0xd27e99, 0x7e9cd8],
81    [0xd27e99, 0x76946a, 0xff5a64, 0xdca561, 0x7e9cd8, 0x6a9589, 0xe46876, 0x957fb8];
82    kanagawa_lotus, "kanagawa-lotus", "Kanagawa Lotus (light, from gitkraft)." =>
83    [0xf6f3e4, 0x545464, 0xc4b28a, 0xe7dba0, 0xa09abe, 0x4d699b, 0x6f894e, 0x77713f, 0xc04747, 0x4d699b],
84    [0xa09abe, 0x6f894e, 0xc04747, 0x77713f, 0x4d699b, 0x648c82, 0xb46478, 0x8c78aa];
85    flexoki_dark, "flexoki-dark", "Flexoki Dark (dark, from gitkraft)." =>
86    [0x100f0f, 0xcecdc3, 0x575653, 0x1e1c1c, 0x4385be, 0x4385be, 0x879a39, 0xd0a215, 0xd14d41, 0x4385be],
87    [0x4385be, 0x879a39, 0xd14d41, 0xd0a215, 0xce5d97, 0x3aa99f, 0xcecdc3, 0xab8d48];
88    flexoki_light, "flexoki-light", "Flexoki Light (light, from gitkraft)." =>
89    [0xfffcf0, 0x100f0f, 0x6f6e69, 0xf2eede, 0x205ea6, 0x205ea6, 0x66800b, 0xad8301, 0xaf3029, 0x205ea6],
90    [0x205ea6, 0x66800b, 0xaf3029, 0xad8301, 0xa34077, 0x24837b, 0x100f0f, 0x85682e];
91    modus_vivendi, "modus-vivendi", "Modus Vivendi." =>
92    [0x000000, 0xffffff, 0x989898, 0x191919, 0x2fafff, 0xfeacd0, 0x44bc44, 0xd0bc00, 0xff5f59, 0x00d3d0],
93    [0x2fafff, 0xd0bc00, 0xfeacd0, 0x44bc44, 0xff5f59, 0x00d3d0, 0xef8b50, 0xb6a0ff];
94    modus_operandi, "modus-operandi", "Modus Operandi." =>
95    [0xffffff, 0x000000, 0x595959, 0xe5e5e5, 0x0031a9, 0x721045, 0x006800, 0x6f5500, 0xa60000, 0x00538b],
96    [0x0031a9, 0x6f5500, 0x721045, 0x006800, 0xa60000, 0x00538b, 0x884900, 0x531ab6];
97    dracula, "dracula", "Dracula (dark)." =>
98    [0x282a36, 0xf8f8f2, 0x8e9bc4, 0x44475a, 0xbd93f9, 0xff79c6, 0x50fa7b, 0xf1fa8c, 0xff5555, 0x8be9fd],
99    [0xbd93f9, 0xff79c6, 0x50fa7b, 0xf1fa8c, 0xffb86c, 0x8be9fd, 0xff5555, 0x6272a4];
100    nord, "nord", "Nord (dark, arctic blues)." =>
101    [0x2e3440, 0xd8dee9, 0x8b96ab, 0x3b4252, 0x88c0d0, 0x81a1c1, 0xa3be8c, 0xebcb8b, 0xbf616a, 0x5e81ac],
102    [0x88c0d0, 0xa3be8c, 0xebcb8b, 0xb48ead, 0xd08770, 0x81a1c1, 0xbf616a, 0x8fbcbb];
103    monokai, "monokai", "Monokai (dark)." =>
104    [0x272822, 0xf8f8f2, 0x90908a, 0x3e3d32, 0x66d9ef, 0xae81ff, 0xa6e22e, 0xe6db74, 0xf92672, 0x66d9ef],
105    [0x66d9ef, 0xa6e22e, 0xf92672, 0xe6db74, 0xae81ff, 0xfd971f, 0x75715e, 0xf8f8f2];
106    alabaster, "alabaster", "Alabaster (light, minimal highlighting)." =>
107    [0xf7f7f7, 0x000000, 0x777777, 0xe8e8e8, 0x325cc0, 0x7a3e9d, 0x448c27, 0xcb9000, 0xaa3731, 0x0083b2],
108    [0x325cc0, 0xcb9000, 0x7a3e9d, 0x448c27, 0xaa3731, 0x0083b2, 0xc4621b, 0x777777];
109    edge_light, "edge-light", "Edge Light (light)." =>
110    [0xfafafa, 0x4b505b, 0x8790a0, 0xeef1f4, 0x5079be, 0xb05ccc, 0x608e32, 0xbe7e05, 0xd05858, 0x3a8b84],
111    [0x5079be, 0xbe7e05, 0xb05ccc, 0x608e32, 0xd05858, 0x3a8b84, 0xc65f2d, 0x7b6fc4];
112    selenized_light, "selenized-light", "Selenized Light (light)." =>
113    [0xfbf3db, 0x53676d, 0x909995, 0xe9e4d0, 0x0072d4, 0xca4898, 0x489100, 0xad8900, 0xd2212d, 0x009c8f],
114    [0x0072d4, 0xad8900, 0xca4898, 0x489100, 0xd2212d, 0x009c8f, 0xc25d1e, 0x8762c6];
115    bluloco_light, "bluloco-light", "Bluloco Light (light)." =>
116    [0xf9f9f9, 0x383a42, 0xa0a1a7, 0xebebeb, 0x275fe4, 0x823ff1, 0x23974a, 0xc5a332, 0xd52753, 0x27618d],
117    [0x275fe4, 0xc5a332, 0x823ff1, 0x23974a, 0xd52753, 0x27618d, 0xdf631c, 0xce33c0];
118    papercolor_light, "papercolor-light", "Papercolor Light." =>
119    [0xeeeeee, 0x444444, 0x878787, 0xdddddd, 0x005f87, 0x8700af, 0x008700, 0xd78700, 0xaf0000, 0x0087af],
120    [0x005f87, 0xd78700, 0x8700af, 0x008700, 0xaf0000, 0x0087af, 0xd75f00, 0x8700af];
121    synthwave, "synthwave", "Synthwave (dark, from gitkraft)." =>
122    [0x0a0810, 0xdad9c7, 0x7f7094, 0x14101e, 0xf6188f, 0x12c3e2, 0x1ebb2b, 0xfdf834, 0xf6188f, 0x12c3e2],
123    [0xf6188f, 0x1ebb2b, 0x12c3e2, 0xfdf834, 0xbe95ff, 0xff7eb6, 0xdad9c7, 0x7f7094];
124    synthwave_outrun, "synthwave-outrun", "Synthwave Outrun." =>
125    [0x262335, 0xffffff, 0x848bbd, 0x3b3949, 0x36f9f6, 0xff7edb, 0x72f1b8, 0xfede5d, 0xfe4450, 0x03edf9],
126    [0x36f9f6, 0xfede5d, 0xff7edb, 0x72f1b8, 0xfe4450, 0x03edf9, 0xf97e72, 0xb893ce];
127    synthwave_dawn, "synthwave-dawn", "Synthwave Dawn (light, synthwave colors on a pink sky)." =>
128    [0xfdf0f8, 0x2b1b3f, 0x7d6a93, 0xf3dcea, 0xc8007a, 0x007a9a, 0x0f7d55, 0xa55f00, 0xc0003c, 0x006fb8],
129    [0xc8007a, 0x007a9a, 0xa55f00, 0x6a2fc2, 0x0f7d55, 0xd2410f, 0x006fb8, 0x9b2c8f];
130    retrowave, "retrowave", "Retrowave (dark, hot pink and cyan on midnight purple)." =>
131    [0x0d0221, 0xf0e6ff, 0x8a7fb0, 0x1b0b3a, 0xff2a6d, 0x05d9e8, 0x2de2a6, 0xffd319, 0xff3864, 0x05d9e8],
132    [0xff2a6d, 0x05d9e8, 0xffd319, 0x9d4edd, 0x2de2a6, 0xff901f, 0xd1f7ff, 0x7b61ff];
133    vaporwave, "vaporwave", "Vaporwave (dark, pastel neon)." =>
134    [0x1a0f2e, 0xf5e9ff, 0x9a86c0, 0x2a1a45, 0xff71ce, 0x01cdfe, 0x05ffa1, 0xfffb96, 0xff5c8a, 0x01cdfe],
135    [0xff71ce, 0x01cdfe, 0x05ffa1, 0xb967ff, 0xfffb96, 0xff9a5c, 0x7aa2ff, 0xff5c8a];
136    laserwave, "laserwave", "Laserwave (dark, retro synth)." =>
137    [0x27212e, 0xffffff, 0x91889b, 0x362d40, 0xeb64b9, 0x40b4c4, 0x74dfc4, 0xffe261, 0xff3e7b, 0xb4dce7],
138    [0xeb64b9, 0x74dfc4, 0x40b4c4, 0xffe261, 0xb381c5, 0xb4dce7, 0xff3e7b, 0x91889b];
139    fairyfloss, "fairyfloss", "Fairyfloss (dark, pastel candy)." =>
140    [0x5a5475, 0xf8f8f2, 0xbbb3d6, 0x716799, 0xffb8d1, 0xc5a3ff, 0xc2ffdf, 0xfffea0, 0xff857f, 0xaee4ff],
141    [0xffb8d1, 0xc5a3ff, 0xc2ffdf, 0xfffea0, 0xff857f, 0xaee4ff, 0xffcc99, 0xe6c000];
142    neon, "neon", "Neon (dark, from gitkraft)." =>
143    [0x06000e, 0xe6e6ff, 0x645078, 0x0f001e, 0xff00c8, 0x00ffc8, 0x00ff82, 0xffdc00, 0xff1e50, 0x00ffc8],
144    [0xff00c8, 0x00ff82, 0xff1e50, 0xffdc00, 0x00ffc8, 0x6450ff, 0xff7800, 0x00b4ff];
145    cyberpunk, "cyberpunk", "Cyberpunk (dark, from gitkraft)." =>
146    [0x0a0a10, 0xe6e6dc, 0x5a5a64, 0x14141e, 0xfcee0a, 0x00d2eb, 0x00dcb4, 0xff9600, 0xff3246, 0x00d2eb],
147    [0xfcee0a, 0x00dcb4, 0xff3246, 0xff9600, 0x00d2eb, 0xb400ff, 0xff0096, 0x00ff64];
148    grape, "grape", "Grape (dark, from gitkraft)." =>
149    [0x120c1e, 0xe6dcff, 0x6e6482, 0x1e1432, 0xc878ff, 0x82b4ff, 0xa06eff, 0xd2aaff, 0xff5096, 0x82b4ff],
150    [0xc878ff, 0xa06eff, 0xff5096, 0xd2aaff, 0x82b4ff, 0x50dcc8, 0xffb464, 0x78ffa0];
151    ocean, "ocean", "Ocean (dark, from gitkraft)." =>
152    [0x001423, 0xc8f0f5, 0x507882, 0x002337, 0x00c8b4, 0x00afd2, 0x50e6c8, 0xffdc50, 0xff6464, 0x00afd2],
153    [0x00c8b4, 0x50e6c8, 0xff6464, 0xffdc50, 0x00afd2, 0xb482ff, 0xffa064, 0xdc78c8];
154    sunset, "sunset", "Sunset (dark, from gitkraft)." =>
155    [0x160806, 0xffebd2, 0x8c6450, 0x280f0a, 0xff5050, 0xff9632, 0xffb450, 0xffe650, 0xff3232, 0xff9632],
156    [0xff5050, 0xffb450, 0xff3232, 0xffe650, 0xff9632, 0x64b4ff, 0xb478ff, 0x50dcc8];
157    forest, "forest", "Forest (dark, from gitkraft)." =>
158    [0x081208, 0xd2ebc8, 0x5a7850, 0x0f1e0f, 0x64c850, 0x50a050, 0x78d25a, 0xdcc850, 0xd25050, 0x50a050],
159    [0x64c850, 0x78d25a, 0xd25050, 0xdcc850, 0x50a050, 0x82a0ff, 0xc882b4, 0xc8b464];
160    rose, "rose", "Rose (dark, from gitkraft)." =>
161    [0x1c0610, 0xffe6eb, 0x8c5a6e, 0x320c1e, 0xff6496, 0xff8cb4, 0xffa0be, 0xffdcb4, 0xdc3c64, 0xff8cb4],
162    [0xff6496, 0xffa0be, 0xdc3c64, 0xffdcb4, 0xff8cb4, 0x64b4ff, 0x78dcc8, 0xc8b464];
163    catppuccin_frappe, "catppuccin-frappe", "Catppuccin Frappé (dark, from gitkraft)." =>
164    [0x303446, 0xc6d0f5, 0x737994, 0x414559, 0xca9ee6, 0x8caaee, 0xa6d189, 0xe5c890, 0xe78284, 0x8caaee],
165    [0xca9ee6, 0xa6d189, 0xe78284, 0xe5c890, 0x8caaee, 0x81c8be, 0xf4b8e4, 0xef9f76];
166    catppuccin_macchiato, "catppuccin-macchiato", "Catppuccin Macchiato (dark, from gitkraft)." =>
167    [0x24273a, 0xcad3f5, 0x6e738d, 0x363a4f, 0xc6a0f6, 0x8aadf4, 0xa6da95, 0xeed49f, 0xed8796, 0x8aadf4],
168    [0xc6a0f6, 0xa6da95, 0xed8796, 0xeed49f, 0x8aadf4, 0x8bd5ca, 0xf5bde6, 0xf0a880];
169    tokyo_night_storm, "tokyo-night-storm", "Tokyo Night Storm (dark, from gitkraft)." =>
170    [0x24283b, 0xc0caf5, 0x565f89, 0x2d314b, 0xbb9af7, 0x7aa2f7, 0x9ece6a, 0xe0af68, 0xf7768e, 0x7aa2f7],
171    [0xbb9af7, 0x9ece6a, 0xf7768e, 0xe0af68, 0x7aa2f7, 0x7dcfff, 0xff9e64, 0x73daca];
172    tokyo_night_light, "tokyo-night-light", "Tokyo Night Light (light, from gitkraft)." =>
173    [0xd5d6db, 0x343b58, 0x848cb0, 0xd0d5e3, 0x5a4a78, 0x2e7ee9, 0x485e30, 0x8c6c3e, 0xd20f39, 0x2e7ee9],
174    [0x5a4a78, 0x485e30, 0xd20f39, 0x8c6c3e, 0x2e7ee9, 0x388c96, 0xa6528c, 0xb46432];
175    kanagawa_dragon, "kanagawa-dragon", "Kanagawa Dragon (dark, from gitkraft)." =>
176    [0x141414, 0xc5c9c5, 0xa6a69c, 0x282727, 0xd27e99, 0x8ba4b0, 0x87a987, 0xc8aa6d, 0xd27e99, 0x8ba4b0],
177    [0xd27e99, 0x87a987, 0xe36464, 0xc8aa6d, 0x8ba4b0, 0x6a9589, 0xc46c7c, 0xa591c4];
178    moonfly, "moonfly", "Moonfly (dark, from gitkraft)." =>
179    [0x080808, 0xb2b2b2, 0x4e4e4e, 0x1c1c1c, 0xae81ff, 0x80a0ff, 0x8cc85f, 0xe2a478, 0xff7383, 0x80a0ff],
180    [0xae81ff, 0x8cc85f, 0xff7383, 0xe2a478, 0x80a0ff, 0x74b4bb, 0xffc078, 0xc88cff];
181    nightfly, "nightfly", "Nightfly (dark, from gitkraft)." =>
182    [0x011626, 0xacbbcb, 0x4b6479, 0x0b2942, 0xc792ea, 0x82aaff, 0xa1cd5e, 0xf3da0b, 0xfc5749, 0x82aaff],
183    [0xc792ea, 0xa1cd5e, 0xfc5749, 0xf3da0b, 0x82aaff, 0x21c8d7, 0xee8262, 0xaec8ff];
184    oxocarbon, "oxocarbon", "Oxocarbon (dark, from gitkraft)." =>
185    [0x161616, 0xf2f4f8, 0x525252, 0x262626, 0xff7eb6, 0x78a9ff, 0x42be65, 0xfacc37, 0xff6165, 0x78a9ff],
186    [0xff7eb6, 0x42be65, 0xff6165, 0xfacc37, 0x78a9ff, 0x08bdba, 0xbe95ff, 0xffaa78];
187    rose_pine_moon, "rose-pine-moon", "Rose Pine Moon (dark, from gitkraft)." =>
188    [0x232136, 0xe0def4, 0x6e6a86, 0x302e46, 0xc4a7e7, 0x9ccfd8, 0x3e8fb0, 0xf6c177, 0xeb6f92, 0x9ccfd8],
189    [0xc4a7e7, 0x3e8fb0, 0xeb6f92, 0xf6c177, 0x9ccfd8, 0xea9a97, 0x9ccfd8, 0xe0def4];
190    ayu_mirage, "ayu-mirage", "Ayu Mirage (dark, from gitkraft)." =>
191    [0x1f2430, 0xcccac2, 0x686868, 0x2a303e, 0x73d0ff, 0x73d0ff, 0x87d96c, 0xfacc6e, 0xed8274, 0x73d0ff],
192    [0x73d0ff, 0x87d96c, 0xed8274, 0xfacc6e, 0x409fff, 0xd9bfff, 0xffaa6c, 0xcccac2];
193    night_owl, "night-owl", "Night Owl (dark, from gitkraft)." =>
194    [0x011627, 0xd6deeb, 0x575656, 0x0c2337, 0x82aaff, 0x82aaff, 0x22da6e, 0xaddb67, 0xef5350, 0x82aaff],
195    [0x82aaff, 0x22da6e, 0xef5350, 0xaddb67, 0xc792ea, 0x7fdbca, 0xd6deeb, 0xffcb8b];
196    light_owl, "light-owl", "Light Owl (light sibling of Night Owl)." =>
197    [0xfbfbfb, 0x403f53, 0x989fb1, 0xf0f0f0, 0x4876d6, 0x994cc3, 0x08916a, 0xdaaa01, 0xde3d3b, 0x0c969b],
198    [0x4876d6, 0xdaaa01, 0x994cc3, 0x08916a, 0xde3d3b, 0x0c969b, 0xaa0982, 0xc96765];
199    poimandres, "poimandres", "Poimandres (dark, from gitkraft)." =>
200    [0x1a1e28, 0xa6accd, 0x646a82, 0x262a37, 0x5de4c7, 0x89ddff, 0x5de4c7, 0xfffac2, 0xd0679d, 0x89ddff],
201    [0x5de4c7, 0x89ddff, 0xd0679d, 0xfffac2, 0xa6accd, 0xaddb67, 0x646a82, 0xffb478];
202    carbonfox, "carbonfox", "Carbonfox (dark, from gitkraft)." =>
203    [0x161616, 0xf2f4f8, 0x64646e, 0x232323, 0x78a9ff, 0x78a9ff, 0x25be6a, 0x08bdba, 0xee5396, 0x78a9ff],
204    [0x78a9ff, 0x25be6a, 0xee5396, 0x08bdba, 0xbe95ff, 0xff7eb6, 0xf2f4f8, 0xffaa78];
205    andromeda, "andromeda", "Andromeda (dark, from gitkraft)." =>
206    [0x262a33, 0xe5e5e5, 0x666666, 0x323742, 0x05bc79, 0x0fa8cd, 0x05bc79, 0xe5e512, 0xcd3131, 0x0fa8cd],
207    [0x05bc79, 0x0fa8cd, 0xcd3131, 0xe5e512, 0xbe95ff, 0xff7eb6, 0xe5e5e5, 0x666666];
208    zenburn, "zenburn", "Zenburn." =>
209    [0x3f3f3f, 0xdcdccc, 0x709080, 0x4e4e4d, 0x8cd0d3, 0xdc8cc3, 0x7f9f7f, 0xf0dfaf, 0xcc9393, 0x93e0e3],
210    [0x8cd0d3, 0xf0dfaf, 0xdc8cc3, 0x7f9f7f, 0xcc9393, 0x93e0e3, 0xdfaf8f, 0xdc8cc3];
211    super_mario, "super-mario", "Super Mario." =>
212    [0x0f0b24, 0xfdfdf5, 0x8a7f9a, 0x262338, 0x1aa5e6, 0xff77d4, 0x3fca3f, 0xffd21e, 0xff3b30, 0x49c6e8],
213    [0x1aa5e6, 0xffd21e, 0xff77d4, 0x3fca3f, 0xff3b30, 0x49c6e8, 0xff9c1a, 0x8a6be0];
214    tokyo_night_moon, "tokyo-night-moon", "Tokyo Night Moon." =>
215    [0x222436, 0xc8d3f5, 0x636da6, 0x323549, 0x82aaff, 0xc099ff, 0xc3e88d, 0xffc777, 0xff757f, 0x86e1fc],
216    [0x82aaff, 0xffc777, 0xc099ff, 0xc3e88d, 0xff757f, 0x86e1fc, 0xff966c, 0xfca7ea];
217    gruvbox_material, "gruvbox-material", "Gruvbox Material." =>
218    [0x282828, 0xd4be98, 0x928374, 0x393733, 0x7daea3, 0xd3869b, 0xa9b665, 0xd8a657, 0xea6962, 0x89b482],
219    [0x7daea3, 0xd8a657, 0xd3869b, 0xa9b665, 0xea6962, 0x89b482, 0xe78a4e, 0xd3869b];
220    gruvbox_material_light, "gruvbox-material-light", "Gruvbox Material Light (light)." =>
221    [0xfbf1c7, 0x654735, 0x928374, 0xf2e5bc, 0x45707a, 0x945e80, 0x6c782e, 0xb47109, 0xc14a4a, 0x4c7a5d],
222    [0x45707a, 0xb47109, 0x945e80, 0x6c782e, 0xc14a4a, 0x4c7a5d, 0xc35e0a, 0x7c6f64];
223    dawnfox, "dawnfox", "Dawnfox." =>
224    [0xfaf4ed, 0x575279, 0xa8a3b3, 0xe9e3e1, 0x286983, 0x907aa9, 0x618774, 0xea9d34, 0xb4637a, 0x56949f],
225    [0x286983, 0xea9d34, 0x907aa9, 0x618774, 0xb4637a, 0x56949f, 0xd7827e, 0x907aa9];
226    melange, "melange", "Melange." =>
227    [0x292522, 0xece1d7, 0x867462, 0x3c3734, 0x7f91b2, 0xb380b0, 0x78997a, 0xebc06d, 0xd47766, 0x7b9695],
228    [0x7f91b2, 0xebc06d, 0xb380b0, 0x78997a, 0xd47766, 0x7b9695, 0xe49b5d, 0xb380b0];
229    material_palenight, "material-palenight", "Material Palenight." =>
230    [0x292d3e, 0xa6accd, 0x676e95, 0x35394c, 0x82aaff, 0xc792ea, 0xc3e88d, 0xffcb6b, 0xf07178, 0x89ddff],
231    [0x82aaff, 0xffcb6b, 0xc792ea, 0xc3e88d, 0xf07178, 0x89ddff, 0xf78c6c, 0xc792ea];
232    material_lighter, "material-lighter", "Material Lighter (light)." =>
233    [0xfafafa, 0x546e7a, 0x90a4ae, 0xeceff1, 0x6182b8, 0x7c4dff, 0x91b859, 0xf6a434, 0xe53935, 0x39adb5],
234    [0x6182b8, 0xf6a434, 0x7c4dff, 0x91b859, 0xe53935, 0x39adb5, 0xf76d47, 0xff5370];
235    tomorrow_night, "tomorrow-night", "Tomorrow Night." =>
236    [0x1d1f21, 0xc5c8c6, 0x969896, 0x2d2f31, 0x81a2be, 0xb294bb, 0xb5bd68, 0xf0c674, 0xcc6666, 0x8abeb7],
237    [0x81a2be, 0xf0c674, 0xb294bb, 0xb5bd68, 0xcc6666, 0x8abeb7, 0xde935f, 0xb294bb];
238    snazzy, "snazzy", "Snazzy." =>
239    [0x282a36, 0xeff0eb, 0x686868, 0x3b3d48, 0x57c7ff, 0xff6ac1, 0x5af78e, 0xf3f99d, 0xff5c57, 0x9aedfe],
240    [0x57c7ff, 0xf3f99d, 0xff6ac1, 0x5af78e, 0xff5c57, 0x9aedfe, 0xff9f43, 0xbd93f9];
241    iceberg, "iceberg", "Iceberg." =>
242    [0x161821, 0xc6c8d1, 0x6b7089, 0x272932, 0x84a0c6, 0xa093c7, 0xb4be82, 0xe9b189, 0xe27878, 0x89b8c2],
243    [0x84a0c6, 0xe9b189, 0xa093c7, 0xb4be82, 0xe27878, 0x89b8c2, 0xe2a478, 0xa093c7];
244    iceberg_light, "iceberg-light", "Iceberg Light (light)." =>
245    [0xe8e9ec, 0x33374c, 0x8389a3, 0xdcdfe7, 0x2d539e, 0x7759b4, 0x668e3d, 0xc57339, 0xcc517a, 0x3f83a6],
246    [0x2d539e, 0xc57339, 0x7759b4, 0x668e3d, 0xcc517a, 0x3f83a6, 0x9a6400, 0x8389a3];
247    cobalt, "cobalt", "Cobalt." =>
248    [0x193549, 0xe1efff, 0x6f8fa3, 0x2d475b, 0x0088ff, 0xfb94ff, 0x3ad900, 0xffc600, 0xff628c, 0x80ffbb],
249    [0x0088ff, 0xffc600, 0xfb94ff, 0x3ad900, 0xff628c, 0x80ffbb, 0xff9d00, 0x9a5feb];
250    horizon, "horizon", "Horizon." =>
251    [0x1c1e26, 0xd5d8da, 0x6c6f93, 0x2e3038, 0x26bbd9, 0xee64ac, 0x29d398, 0xfac29a, 0xe95678, 0x59e1e3],
252    [0x26bbd9, 0xfac29a, 0xee64ac, 0x29d398, 0xe95678, 0x59e1e3, 0xfab795, 0xb877db];
253    sonokai, "sonokai", "Sonokai." =>
254    [0x2c2e34, 0xe2e2e3, 0x7f8490, 0x3e4045, 0x7ec8e3, 0xb39df3, 0x9ed072, 0xe7c664, 0xfc5d7c, 0x76cce0],
255    [0x7ec8e3, 0xe7c664, 0xb39df3, 0x9ed072, 0xfc5d7c, 0x76cce0, 0xf39660, 0xb39df3];
256    clair_obscur, "clair-obscur", "Clair Obscur." =>
257    [0x0b0d17, 0xe9dfc7, 0x5d6178, 0x212228, 0x4a78c2, 0xc9708a, 0x8fae8b, 0xe3b95a, 0xd4343f, 0x7fd0e0],
258    [0x4a78c2, 0xe3b95a, 0xc9708a, 0x8fae8b, 0xd4343f, 0x7fd0e0, 0xd98a3d, 0x8a6bbf];
259    clair_obscur_canvas, "clair-obscur-canvas", "Clair Obscur Canvas." =>
260    [0xefe4cc, 0x2b2433, 0x8a7f72, 0xdbd0bc, 0x2a4f8f, 0x8f3b58, 0x4d6b4a, 0x8c6a12, 0xa3212c, 0x2a6f80],
261    [0x2a4f8f, 0x8c6a12, 0x8f3b58, 0x4d6b4a, 0xa3212c, 0x2a6f80, 0xb4601f, 0x5e3f8c];
262    mario_overworld, "mario-overworld", "Mario Overworld." =>
263    [0xa6d8ff, 0x14173d, 0x5b6a8a, 0x97c4eb, 0x0b4fa8, 0xa1307a, 0x1c7a2a, 0x8a6a00, 0xc4161c, 0x00738f],
264    [0x0b4fa8, 0x8a6a00, 0xa1307a, 0x1c7a2a, 0xc4161c, 0x00738f, 0xb85c00, 0x5a3da8];
265    mario_underground, "mario-underground", "Mario Underground." =>
266    [0x02030f, 0xe8f0ff, 0x5a6a9a, 0x191a27, 0x3b7bff, 0xff6fc8, 0x3fd16a, 0xfcd23a, 0xff4d3d, 0x3ee0e8],
267    [0x3b7bff, 0xfcd23a, 0xff6fc8, 0x3fd16a, 0xff4d3d, 0x3ee0e8, 0xf89b3a, 0x8f7bff];
268    pip_boy, "pip-boy", "Pip Boy." =>
269    [0x031208, 0x46ff90, 0x1f8f55, 0x092915, 0x29d97a, 0x9dffb0, 0x3dff8a, 0xe6ff7a, 0xff8a3d, 0x6dffd0],
270    [0x29d97a, 0xe6ff7a, 0x9dffb0, 0x3dff8a, 0xff8a3d, 0x6dffd0, 0xc8ff4d, 0x7fe0a0];
271    tarnished, "tarnished", "Tarnished." =>
272    [0x0e0c09, 0xe6d8b0, 0x6f654f, 0x232019, 0x5d7690, 0x9c5f6e, 0x7a8c52, 0xe3b24a, 0xa63a2f, 0x7fa8a0],
273    [0x5d7690, 0xe3b24a, 0x9c5f6e, 0x7a8c52, 0xa63a2f, 0x7fa8a0, 0xc77f2e, 0x77608f];
274    hyrule, "hyrule", "Hyrule." =>
275    [0x0f1a14, 0xe8e2c4, 0x5f7060, 0x242e25, 0x4aa3d6, 0xc06fa8, 0x6fbf5b, 0xf2d04a, 0xd6453a, 0x5ed1c7],
276    [0x4aa3d6, 0xf2d04a, 0xc06fa8, 0x6fbf5b, 0xd6453a, 0x5ed1c7, 0xe08a2c, 0x8a78c8];
277    doom, "doom", "Doom." =>
278    [0x120c0b, 0xd9cfc4, 0x6a5f58, 0x251f1d, 0x4a6ea8, 0xb0407a, 0x4aa83a, 0xffc21a, 0xe5251c, 0x3aa5a0],
279    [0x4a6ea8, 0xffc21a, 0xb0407a, 0x4aa83a, 0xe5251c, 0x3aa5a0, 0xff7a1a, 0x7a4a9a];
280    phantom, "phantom", "Phantom." =>
281    [0x0a0a0a, 0xf2f2f2, 0x6b6b6b, 0x212121, 0x2f6bff, 0xff2a8a, 0x4ad06a, 0xffd400, 0xe60012, 0x3fd0ff],
282    [0x2f6bff, 0xffd400, 0xff2a8a, 0x4ad06a, 0xe60012, 0x3fd0ff, 0xff5a36, 0x8a3fff];
283    cavern_hush, "cavern-hush", "Cavern Hush." =>
284    [0x080b14, 0xdfe7ef, 0x4a5568, 0x1d2129, 0x5b7bb5, 0xa58ac0, 0x7fb7a4, 0xd8c58a, 0xc8505a, 0x9ee6f0],
285    [0x5b7bb5, 0xd8c58a, 0xa58ac0, 0x7fb7a4, 0xc8505a, 0x9ee6f0, 0xd0905a, 0x7a6aa8];
286    test_chamber, "test-chamber", "Test Chamber." =>
287    [0x12151a, 0xe9edf2, 0x5d6773, 0x272a2f, 0x1d8cff, 0xd57bff, 0x5ed17a, 0xffd24a, 0xff4b4b, 0x3ec3ff],
288    [0x1d8cff, 0xffd24a, 0xd57bff, 0x5ed17a, 0xff4b4b, 0x3ec3ff, 0xff9a1f, 0x8e7bff];
289    ember, "ember", "Ember." =>
290    [0x0d0b0a, 0xd8cfc2, 0x6a6158, 0x211e1c, 0x5f7691, 0x94616e, 0x7c8a5b, 0xd9a441, 0xb5382d, 0x6d9a9a],
291    [0x5f7691, 0xd9a441, 0x94616e, 0x7c8a5b, 0xb5382d, 0x6d9a9a, 0xe0782a, 0x75618a];
292    meadow, "meadow", "Meadow." =>
293    [0xf6efdc, 0x4a3b2a, 0x9a8a70, 0xe4ddca, 0x3e6fa8, 0xa2566e, 0x4f7a3a, 0xa8821c, 0xb8433a, 0x2f7f87],
294    [0x3e6fa8, 0xa8821c, 0xa2566e, 0x4f7a3a, 0xb8433a, 0x2f7f87, 0xc4742a, 0x7a5a9a];
295    dojo, "dojo", "Dojo." =>
296    [0x0f0f14, 0xf1f1f1, 0x66666e, 0x25252a, 0x2f6fe8, 0xff3d9a, 0x35c759, 0xffe033, 0xe8222a, 0x3ac7ff],
297    [0x2f6fe8, 0xffe033, 0xff3d9a, 0x35c759, 0xe8222a, 0x3ac7ff, 0xff8a1f, 0x8a4dff];
298    underworld, "underworld", "Underworld." =>
299    [0x120b12, 0xecdcc8, 0x6b5a66, 0x271f24, 0x5a7fd6, 0xd86aa0, 0x6fbf8a, 0xf5c04a, 0xe0352b, 0x6ad5d0],
300    [0x5a7fd6, 0xf5c04a, 0xd86aa0, 0x6fbf8a, 0xe0352b, 0x6ad5d0, 0xf08a3a, 0x9a5fd0];
301    summit, "summit", "Summit." =>
302    [0x1c1b2e, 0xeae6ff, 0x6d6a8f, 0x302f42, 0x6d8cff, 0xff7ad9, 0x7ee8a2, 0xffe36e, 0xff5c7c, 0x6ad8ff],
303    [0x6d8cff, 0xffe36e, 0xff7ad9, 0x7ee8a2, 0xff5c7c, 0x6ad8ff, 0xff9e5e, 0xa07bff];
304    rain_noir, "rain-noir", "Rain Noir." =>
305    [0x14171c, 0xd9d4c7, 0x5f6670, 0x27292d, 0x5a7fa8, 0xa06a86, 0x6f9a7c, 0xd4b24e, 0xb24a3a, 0x5aa3a8],
306    [0x5a7fa8, 0xd4b24e, 0xa06a86, 0x6f9a7c, 0xb24a3a, 0x5aa3a8, 0xcf8a3a, 0x7e6c9a];
307    blocky, "blocky", "Blocky." =>
308    [0x12100d, 0xe9e6df, 0x6f6a60, 0x272522, 0x3d62d6, 0xd26ad6, 0x5fb23a, 0xf3d04a, 0xd9443a, 0x4de3dc],
309    [0x3d62d6, 0xf3d04a, 0xd26ad6, 0x5fb23a, 0xd9443a, 0x4de3dc, 0xe08a2c, 0x9a5fd0];
310    duskfox, "duskfox", "Duskfox." =>
311    [0x232136, 0xe0def4, 0x6e6a86, 0x353349, 0x569fba, 0xc4a7e7, 0xa3be8c, 0xf6c177, 0xeb6f92, 0x9ccfd8],
312    [0x569fba, 0xf6c177, 0xc4a7e7, 0xa3be8c, 0xeb6f92, 0x9ccfd8, 0xea9a97, 0xa58ec7];
313}
314
315impl Theme {
316    /// Porsche: black/white with the signature red accent (`#D5001C`).
317    ///
318    /// Bull is white and bear is red, as in the Porsche chart look.
319    #[must_use]
320    pub fn porsche() -> Self {
321        let mut t = Self::from_spec(
322            "porsche",
323            Spec {
324                bg: 0x000000,
325                fg: 0xffffff,
326                muted: 0x9b9ba0,
327                surface: 0x1a1a1c,
328                accent: 0xd5001c,
329                secondary: 0xe3e3e6,
330                success: 0x2e9e5b,
331                warning: 0xf5a623,
332                error: 0xff4d5e,
333                info: 0x4aa3ff,
334                palette: &[
335                    0xd5001c, 0xffffff, 0x9b9ba0, 0xff5a6e, 0x6b6b70, 0xe3e3e6, 0x8c0014, 0xc4c4c8,
336                ],
337            },
338        );
339        t.bull = rgb(0xffffff);
340        t.bear = rgb(0xd5001c);
341        t
342    }
343
344    /// Colorblind-safe theme (Okabe–Ito palette; blue/orange instead of
345    /// green/red). Keeps the terminal background.
346    #[must_use]
347    pub fn colorblind() -> Self {
348        let mut t = Self::from_spec(
349            "colorblind",
350            Spec {
351                bg: 0x000000,
352                fg: 0xffffff,
353                muted: 0xbbbbbb,
354                surface: 0x222222,
355                accent: 0x56b4e9,
356                secondary: 0xcc79a7,
357                success: 0x0072b2,
358                warning: 0xf0e442,
359                error: 0xe69f00,
360                info: 0x56b4e9,
361                palette: &[
362                    0x0072b2, 0xe69f00, 0x009e73, 0xf0e442, 0x56b4e9, 0xd55e00, 0xcc79a7, 0xbbbbbb,
363                ],
364            },
365        );
366        t.background = None;
367        t.surface = None;
368        t.tooltip_bg = Color::DarkGray;
369        t.neutral = rgb(0xbbbbbb);
370        t
371    }
372
373    /// Maximum-contrast theme: pure black/white with saturated status colors.
374    #[must_use]
375    pub fn high_contrast() -> Self {
376        let mut t = Self::from_spec(
377            "high-contrast",
378            Spec {
379                bg: 0x000000,
380                fg: 0xffffff,
381                muted: 0xd0d0d0,
382                surface: 0x1c1c1c,
383                accent: 0xffff00,
384                secondary: 0x00ffff,
385                success: 0x00ff00,
386                warning: 0xffa500,
387                error: 0xff5050,
388                info: 0x00ffff,
389                palette: &[
390                    0xffff00, 0x00ffff, 0xff00ff, 0x00ff00, 0xff5050, 0xffa500, 0x5f9fff, 0xffffff,
391                ],
392            },
393        );
394        t.border = rgb(0xffffff);
395        t.selection_bg = rgb(0xffffff);
396        t.selection_fg = rgb(0x000000);
397        t.disabled = rgb(0xa0a0a0);
398        t
399    }
400
401    /// Monochrome theme for 1-bit-ish terminals: only white, gray and dark
402    /// gray, terminal background. Selection is shown in reverse video colors.
403    #[must_use]
404    pub fn mono() -> Self {
405        Self {
406            name: "mono".into(),
407            background: None,
408            surface: None,
409            foreground: Color::White,
410            muted: Color::Gray,
411            disabled: Color::DarkGray,
412            border: Color::Gray,
413            border_focused: Color::White,
414            title: Color::White,
415            primary: Color::White,
416            secondary: Color::Gray,
417            accent: Color::White,
418            success: Color::White,
419            warning: Color::Gray,
420            error: Color::White,
421            info: Color::Gray,
422            selection_bg: Color::White,
423            selection_fg: Color::Black,
424            highlight: Color::White,
425            palette: vec![
426                Color::White,
427                Color::Gray,
428                Color::DarkGray,
429                Color::White,
430                Color::Gray,
431                Color::DarkGray,
432                Color::White,
433                Color::Gray,
434            ],
435            bull: Color::White,
436            bear: Color::DarkGray,
437            neutral: Color::Gray,
438            axis: Color::DarkGray,
439            grid: Color::DarkGray,
440            crosshair: Color::Gray,
441            tooltip_fg: Color::Black,
442            tooltip_bg: Color::White,
443        }
444    }
445
446    /// All built-in themes, in cycling order.
447    #[must_use]
448    pub fn all() -> Vec<Theme> {
449        let mut v = vec![Theme::default()];
450        v.extend(NAMED.iter().map(|(_, f)| f()));
451        v.push(Theme::porsche());
452        v.push(Theme::colorblind());
453        v.push(Theme::high_contrast());
454        v.push(Theme::mono());
455        let (light, dark): (Vec<Theme>, Vec<Theme>) = v
456            .into_iter()
457            .partition(|t| t.background.is_some_and(crate::color::is_light));
458        // Blocks of `CYCLE_BLOCK`: dark, light, dark, light … then whatever is left.
459        let (mut dark, mut light) = (dark.into_iter(), light.into_iter());
460        let mut out = Vec::new();
461        loop {
462            let before = out.len();
463            out.extend(dark.by_ref().take(CYCLE_BLOCK));
464            out.extend(light.by_ref().take(CYCLE_BLOCK));
465            if out.len() == before {
466                return out;
467            }
468        }
469    }
470
471    /// Names of all built-in themes, in cycling order.
472    #[must_use]
473    pub fn names() -> Vec<&'static str> {
474        let mut index: std::collections::HashMap<String, &'static str> =
475            NAMED.iter().map(|(n, _)| ((*n).to_string(), *n)).collect();
476        for n in ["default", "porsche", "colorblind", "high-contrast", "mono"] {
477            index.insert(n.to_string(), n);
478        }
479        Self::all().iter().map(|t| index[t.name.as_str()]).collect()
480    }
481
482    /// Look a built-in theme up by name. Case-insensitive; `_` and spaces
483    /// are accepted for `-` (`"Tokyo Night"` → `tokyo-night`).
484    #[must_use]
485    pub fn by_name(name: &str) -> Option<Theme> {
486        let key: String = name
487            .trim()
488            .chars()
489            .map(|c| match c {
490                'é' | 'è' | 'É' => 'e',
491                c => c.to_ascii_lowercase(),
492            })
493            .collect::<String>()
494            .replace(['_', ' '], "-");
495        Self::all().into_iter().find(|t| t.name == key)
496    }
497
498    fn position(&self) -> Option<usize> {
499        Self::names().iter().position(|n| *n == self.name)
500    }
501
502    /// The next built-in theme (wraps). Custom-named themes start at `default`.
503    #[must_use]
504    pub fn next(&self) -> Theme {
505        let all = Self::all();
506        let i = self.position().map_or(0, |i| (i + 1) % all.len());
507        all[i].clone()
508    }
509
510    /// The previous built-in theme (wraps). Custom-named themes start at the last one.
511    #[must_use]
512    pub fn prev(&self) -> Theme {
513        let all = Self::all();
514        let i = self
515            .position()
516            .map_or(all.len() - 1, |i| (i + all.len() - 1) % all.len());
517        all[i].clone()
518    }
519}
520
521#[cfg(test)]
522mod tests {
523    use super::*;
524
525    #[test]
526    fn names_match_all() {
527        let all: Vec<String> = Theme::all().into_iter().map(|t| t.name).collect();
528        assert_eq!(all, Theme::names());
529    }
530
531    #[test]
532    fn all_names_unique() {
533        let names = Theme::names();
534        assert_eq!(names.len(), 104);
535        let mut sorted = names.clone();
536        sorted.sort_unstable();
537        sorted.dedup();
538        assert_eq!(sorted.len(), names.len());
539    }
540
541    #[test]
542    fn by_name_accepts_variants() {
543        assert_eq!(Theme::by_name("Tokyo Night").unwrap().name, "tokyo-night");
544        assert_eq!(Theme::by_name("ROSE_PINE").unwrap().name, "rose-pine");
545        assert_eq!(
546            Theme::by_name("Catppuccin Frappé").unwrap().name,
547            "catppuccin-frappe"
548        );
549        assert!(Theme::by_name("nope").is_none());
550        assert!(Theme::by_name("").is_none());
551    }
552
553    #[test]
554    fn next_prev_inverse_and_wrap() {
555        let all = Theme::all();
556        for t in &all {
557            assert_eq!(t.next().prev(), *t);
558        }
559        assert_eq!(all.last().unwrap().next(), all[0]);
560        assert_eq!(all[0].prev(), *all.last().unwrap());
561    }
562
563    #[test]
564    fn custom_theme_cycles_into_builtins() {
565        let c = Theme::default().name("mine");
566        assert_eq!(c.next().name, "default");
567        assert_eq!(c.prev().name, "mono");
568    }
569
570    #[test]
571    fn porsche_bull_is_white() {
572        assert_eq!(Theme::porsche().bull, Color::Rgb(255, 255, 255));
573        assert_eq!(Theme::porsche().accent, Color::Rgb(0xd5, 0x00, 0x1c));
574    }
575
576    #[test]
577    fn colorblind_has_no_green_red_pair() {
578        let t = Theme::colorblind();
579        assert_eq!(t.background, None);
580        assert_eq!(t.bull, Color::Rgb(0, 0x72, 0xb2));
581    }
582}