|
1 | 1 | use ratatui::style::Color as RatatuiColor; |
| 2 | +use serde::Deserialize; |
| 3 | +use smart_default::SmartDefault; |
| 4 | +use umbra::optional; |
2 | 5 |
|
3 | 6 | use crate::config::GraphColorConfig; |
4 | 7 |
|
5 | | -#[derive(Debug)] |
| 8 | +#[optional(derives = [Deserialize], visibility = pub)] |
| 9 | +#[derive(Debug, Clone, PartialEq, Eq, SmartDefault)] |
6 | 10 | pub struct ColorTheme { |
| 11 | + #[default(RatatuiColor::Reset)] |
7 | 12 | pub fg: RatatuiColor, |
| 13 | + #[default(RatatuiColor::Reset)] |
8 | 14 | pub bg: RatatuiColor, |
9 | 15 |
|
| 16 | + #[default(RatatuiColor::White)] |
10 | 17 | pub list_selected_fg: RatatuiColor, |
| 18 | + #[default(RatatuiColor::DarkGray)] |
11 | 19 | pub list_selected_bg: RatatuiColor, |
| 20 | + #[default(RatatuiColor::Yellow)] |
12 | 21 | pub list_ref_paren_fg: RatatuiColor, |
| 22 | + #[default(RatatuiColor::Green)] |
13 | 23 | pub list_ref_branch_fg: RatatuiColor, |
| 24 | + #[default(RatatuiColor::Red)] |
14 | 25 | pub list_ref_remote_branch_fg: RatatuiColor, |
| 26 | + #[default(RatatuiColor::Yellow)] |
15 | 27 | pub list_ref_tag_fg: RatatuiColor, |
| 28 | + #[default(RatatuiColor::Magenta)] |
16 | 29 | pub list_ref_stash_fg: RatatuiColor, |
| 30 | + #[default(RatatuiColor::Cyan)] |
17 | 31 | pub list_head_fg: RatatuiColor, |
| 32 | + #[default(RatatuiColor::Reset)] |
18 | 33 | pub list_subject_fg: RatatuiColor, |
| 34 | + #[default(RatatuiColor::Cyan)] |
19 | 35 | pub list_name_fg: RatatuiColor, |
| 36 | + #[default(RatatuiColor::Yellow)] |
20 | 37 | pub list_hash_fg: RatatuiColor, |
| 38 | + #[default(RatatuiColor::Magenta)] |
21 | 39 | pub list_date_fg: RatatuiColor, |
| 40 | + #[default(RatatuiColor::Black)] |
22 | 41 | pub list_match_fg: RatatuiColor, |
| 42 | + #[default(RatatuiColor::Yellow)] |
23 | 43 | pub list_match_bg: RatatuiColor, |
24 | 44 |
|
| 45 | + #[default(RatatuiColor::Blue)] |
25 | 46 | pub detail_email_fg: RatatuiColor, |
| 47 | + #[default(RatatuiColor::Green)] |
26 | 48 | pub detail_ref_branch_fg: RatatuiColor, |
| 49 | + #[default(RatatuiColor::Red)] |
27 | 50 | pub detail_ref_remote_branch_fg: RatatuiColor, |
| 51 | + #[default(RatatuiColor::Yellow)] |
28 | 52 | pub detail_ref_tag_fg: RatatuiColor, |
| 53 | + #[default(RatatuiColor::Green)] |
29 | 54 | pub detail_file_change_add_fg: RatatuiColor, |
| 55 | + #[default(RatatuiColor::Yellow)] |
30 | 56 | pub detail_file_change_modify_fg: RatatuiColor, |
| 57 | + #[default(RatatuiColor::Red)] |
31 | 58 | pub detail_file_change_delete_fg: RatatuiColor, |
| 59 | + #[default(RatatuiColor::Magenta)] |
32 | 60 | pub detail_file_change_move_fg: RatatuiColor, |
33 | 61 |
|
| 62 | + #[default(RatatuiColor::White)] |
34 | 63 | pub ref_selected_fg: RatatuiColor, |
| 64 | + #[default(RatatuiColor::DarkGray)] |
35 | 65 | pub ref_selected_bg: RatatuiColor, |
36 | 66 |
|
| 67 | + #[default(RatatuiColor::Green)] |
37 | 68 | pub help_block_title_fg: RatatuiColor, |
| 69 | + #[default(RatatuiColor::Yellow)] |
38 | 70 | pub help_key_fg: RatatuiColor, |
39 | 71 |
|
| 72 | + #[default(RatatuiColor::Reset)] |
40 | 73 | pub virtual_cursor_fg: RatatuiColor, |
| 74 | + #[default(RatatuiColor::Reset)] |
41 | 75 | pub status_input_fg: RatatuiColor, |
| 76 | + #[default(RatatuiColor::DarkGray)] |
42 | 77 | pub status_input_transient_fg: RatatuiColor, |
| 78 | + #[default(RatatuiColor::Cyan)] |
43 | 79 | pub status_info_fg: RatatuiColor, |
| 80 | + #[default(RatatuiColor::Green)] |
44 | 81 | pub status_success_fg: RatatuiColor, |
| 82 | + #[default(RatatuiColor::Yellow)] |
45 | 83 | pub status_warn_fg: RatatuiColor, |
| 84 | + #[default(RatatuiColor::Red)] |
46 | 85 | pub status_error_fg: RatatuiColor, |
47 | 86 |
|
| 87 | + #[default(RatatuiColor::DarkGray)] |
48 | 88 | pub divider_fg: RatatuiColor, |
49 | 89 | } |
50 | 90 |
|
51 | | -impl Default for ColorTheme { |
52 | | - fn default() -> Self { |
53 | | - Self { |
54 | | - fg: RatatuiColor::Reset, |
55 | | - bg: RatatuiColor::Reset, |
56 | | - |
57 | | - list_selected_fg: RatatuiColor::White, |
58 | | - list_selected_bg: RatatuiColor::DarkGray, |
59 | | - list_ref_paren_fg: RatatuiColor::Yellow, |
60 | | - list_ref_branch_fg: RatatuiColor::Green, |
61 | | - list_ref_remote_branch_fg: RatatuiColor::Red, |
62 | | - list_ref_tag_fg: RatatuiColor::Yellow, |
63 | | - list_ref_stash_fg: RatatuiColor::Magenta, |
64 | | - list_head_fg: RatatuiColor::Cyan, |
65 | | - list_subject_fg: RatatuiColor::Reset, |
66 | | - list_name_fg: RatatuiColor::Cyan, |
67 | | - list_hash_fg: RatatuiColor::Yellow, |
68 | | - list_date_fg: RatatuiColor::Magenta, |
69 | | - list_match_fg: RatatuiColor::Black, |
70 | | - list_match_bg: RatatuiColor::Yellow, |
71 | | - |
72 | | - detail_email_fg: RatatuiColor::Blue, |
73 | | - detail_ref_branch_fg: RatatuiColor::Green, |
74 | | - detail_ref_remote_branch_fg: RatatuiColor::Red, |
75 | | - detail_ref_tag_fg: RatatuiColor::Yellow, |
76 | | - detail_file_change_add_fg: RatatuiColor::Green, |
77 | | - detail_file_change_modify_fg: RatatuiColor::Yellow, |
78 | | - detail_file_change_delete_fg: RatatuiColor::Red, |
79 | | - detail_file_change_move_fg: RatatuiColor::Magenta, |
80 | | - |
81 | | - ref_selected_fg: RatatuiColor::White, |
82 | | - ref_selected_bg: RatatuiColor::DarkGray, |
83 | | - |
84 | | - help_block_title_fg: RatatuiColor::Green, |
85 | | - help_key_fg: RatatuiColor::Yellow, |
86 | | - |
87 | | - virtual_cursor_fg: RatatuiColor::Reset, |
88 | | - status_input_fg: RatatuiColor::Reset, |
89 | | - status_input_transient_fg: RatatuiColor::DarkGray, |
90 | | - status_info_fg: RatatuiColor::Cyan, |
91 | | - status_success_fg: RatatuiColor::Green, |
92 | | - status_warn_fg: RatatuiColor::Yellow, |
93 | | - status_error_fg: RatatuiColor::Red, |
94 | | - |
95 | | - divider_fg: RatatuiColor::DarkGray, |
96 | | - } |
97 | | - } |
98 | | -} |
99 | | - |
100 | 91 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
101 | 92 | pub struct GraphColor { |
102 | 93 | r: u8, |
|
0 commit comments