Debian Codegraph @

src/options/config/style/themes/gruvbox.rs

raw symbols SCIP
1 use ratatui::{
2 style::{Color, Modifier, Style},
3 widgets::BorderType,
4 };
5
6 use super::{colour, hex};
7 use crate::options::config::style::{Styles, themes::hex_colour};
8
9 impl Styles {
10 pub(crate) fn gruvbox_palette() -> Self {
11 let list_colours = vec![
12 hex!("#cc241d"),
13 hex!("#98971a"),
14 hex!("#d79921"),
15 hex!("#458588"),
16 hex!("#b16286"),
17 hex!("#689d6a"),
18 hex!("#fe8019"),
19 hex!("#b8bb26"),
20 hex!("#fabd2f"),
21 hex!("#83a598"),
22 hex!("#d3869b"),
23 hex!("#d65d0e"),
24 hex!("#9d0006"),
25 hex!("#79740e"),
26 hex!("#b57614"),
27 hex!("#076678"),
28 hex!("#8f3f71"),
29 hex!("#427b58"),
30 hex!("#d65d03"),
31 hex!("#af3a03"),
32 ];
33
34 let second_colours_list = vec![
35 hex!("#d79921"),
36 hex!("#458588"),
37 hex!("#b16286"),
38 hex!("#fe8019"),
39 hex!("#b8bb26"),
40 hex!("#cc241d"),
41 hex!("#98971a"),
42 ];
43
44 Self {
45 ram_style: hex!("#8ec07c"),
46 #[cfg(not(target_os = "windows"))]
47 cache_style: hex!("#b16286"),
48 swap_style: hex!("#fabd2f"),
49 #[cfg(feature = "zfs")]
50 arc_style: hex!("#689d6a"),
51 #[cfg(feature = "gpu")]
52 gpu_colours: second_colours_list.clone(),
53 rx_style: hex!("#8ec07c"),
54 tx_style: hex!("#fabd2f"),
55 total_rx_style: hex!("#689d6a"),
56 total_tx_style: hex!("#d79921"),
57 all_cpu_colour: hex!("#8ec07c"),
58 avg_cpu_colour: hex!("#fb4934"),
59 cpu_colour_styles: list_colours.clone(),
60 temp_graph_colour_styles: list_colours.clone(),
61 disk_io_read_colour_styles: list_colours,
62 disk_io_write_colour_styles: second_colours_list,
63 border_style: hex!("#ebdbb2"),
64 highlighted_border_style: hex!("#fe8019"),
65 text_style: hex!("#ebdbb2"),
66 selected_text_style: hex!("#1d2021").bg(hex_colour!("#ebdbb2")),
67 table_header_style: hex!("#83a598").add_modifier(Modifier::BOLD),
68 general_widget_style: Style::default(),
69 widget_title_style: hex!("#ebdbb2"),
70 graph_style: hex!("#ebdbb2"),
71 graph_legend_style: hex!("#ebdbb2"),
72 high_battery: hex!("#98971a"),
73 medium_battery: hex!("#fabd2f"),
74 low_battery: hex!("#fb4934"),
75 invalid_query_style: colour!(Color::Red),
76 disabled_text_style: hex!("#665c54"),
77 border_type: BorderType::Plain,
78 #[cfg(target_os = "linux")]
79 thread_text_style: hex!("#458588"),
80 }
81 }
82
83 pub(crate) fn gruvbox_light_palette() -> Self {
84 let list_colours = vec![
85 hex!("#cc241d"),
86 hex!("#98971a"),
87 hex!("#d79921"),
88 hex!("#458588"),
89 hex!("#b16286"),
90 hex!("#689d6a"),
91 hex!("#fe8019"),
92 hex!("#b8bb26"),
93 hex!("#fabd2f"),
94 hex!("#83a598"),
95 hex!("#d3869b"),
96 hex!("#d65d0e"),
97 hex!("#9d0006"),
98 hex!("#79740e"),
99 hex!("#b57614"),
100 hex!("#076678"),
101 hex!("#8f3f71"),
102 hex!("#427b58"),
103 hex!("#d65d03"),
104 hex!("#af3a03"),
105 ];
106
107 Self {
108 ram_style: hex!("#427b58"),
109 #[cfg(not(target_os = "windows"))]
110 cache_style: hex!("#d79921"),
111 swap_style: hex!("#cc241d"),
112 #[cfg(feature = "zfs")]
113 arc_style: hex!("#689d6a"),
114 #[cfg(feature = "gpu")]
115 gpu_colours: vec![
116 hex!("#9d0006"),
117 hex!("#98971a"),
118 hex!("#d79921"),
119 hex!("#458588"),
120 hex!("#b16286"),
121 hex!("#fe8019"),
122 hex!("#b8bb26"),
123 ],
124 rx_style: hex!("#427b58"),
125 tx_style: hex!("#cc241d"),
126 total_rx_style: hex!("#689d6a"),
127 total_tx_style: hex!("#d79921"),
128 all_cpu_colour: hex!("#8ec07c"),
129 avg_cpu_colour: hex!("#fb4934"),
130 cpu_colour_styles: list_colours.clone(),
131 temp_graph_colour_styles: list_colours.clone(),
132 disk_io_read_colour_styles: list_colours,
133 disk_io_write_colour_styles: vec![
134 hex!("#9d0006"),
135 hex!("#98971a"),
136 hex!("#d79921"),
137 hex!("#458588"),
138 hex!("#b16286"),
139 hex!("#fe8019"),
140 hex!("#b8bb26"),
141 ],
142 border_style: hex!("#3c3836"),
143 highlighted_border_style: hex!("#af3a03"),
144 text_style: hex!("#3c3836"),
145 selected_text_style: hex!("#ebdbb2").bg(hex_colour!("#3c3836")),
146 table_header_style: hex!("#076678").add_modifier(Modifier::BOLD),
147 general_widget_style: Style::default(),
148 widget_title_style: hex!("#3c3836"),
149 graph_style: hex!("#3c3836"),
150 graph_legend_style: hex!("#3c3836"),
151 high_battery: hex!("#98971a"),
152 medium_battery: hex!("#d79921"),
153 low_battery: hex!("#cc241d"),
154 invalid_query_style: colour!(Color::Red),
155 disabled_text_style: hex!("#d5c4a1"),
156 border_type: BorderType::Plain,
157 #[cfg(target_os = "linux")]
158 thread_text_style: hex!("#458588"),
159 }
160 }
161 }
162
163 #[cfg(test)]
164 mod tests {
165 #[test]
166 fn gruvbox_palettes_valid() {
167 let _ = super::Styles::gruvbox_palette();
168 let _ = super::Styles::gruvbox_light_palette();
169 }
170 }