1use gpui::Hsla;
2use refineable::Refineable;
3
4use crate::{blue, grass, neutral, red, yellow};
5
6#[derive(Refineable, Clone, Debug)]
7#[refineable(Debug, serde::Deserialize)]
8pub struct StatusColors {
9 /// Indicates some kind of conflict, like a file changed on disk while it was open, or
10 /// merge conflicts in a Git repository.
11 pub conflict: Hsla,
12 pub conflict_background: Hsla,
13 pub conflict_border: Hsla,
14
15 /// Indicates something new, like a new file added to a Git repository.
16 pub created: Hsla,
17 pub created_background: Hsla,
18 pub created_border: Hsla,
19
20 /// Indicates that something no longer exists, like a deleted file.
21 pub deleted: Hsla,
22 pub deleted_background: Hsla,
23 pub deleted_border: Hsla,
24
25 /// Indicates a system error, a failed operation or a diagnostic error.
26 pub error: Hsla,
27 pub error_background: Hsla,
28 pub error_border: Hsla,
29
30 /// Represents a hidden status, such as a file being hidden in a file tree.
31 pub hidden: Hsla,
32 pub hidden_background: Hsla,
33 pub hidden_border: Hsla,
34
35 /// Indicates a hint or some kind of additional information.
36 pub hint: Hsla,
37 pub hint_background: Hsla,
38 pub hint_border: Hsla,
39
40 /// Indicates that something is deliberately ignored, such as a file or operation ignored by Git.
41 pub ignored: Hsla,
42 pub ignored_background: Hsla,
43 pub ignored_border: Hsla,
44
45 /// Represents informational status updates or messages.
46 pub info: Hsla,
47 pub info_background: Hsla,
48 pub info_border: Hsla,
49
50 /// Indicates a changed or altered status, like a file that has been edited.
51 pub modified: Hsla,
52 pub modified_background: Hsla,
53 pub modified_border: Hsla,
54
55 /// Indicates something that is predicted, like automatic code completion, or generated code.
56 pub predictive: Hsla,
57 pub predictive_background: Hsla,
58 pub predictive_border: Hsla,
59
60 /// Represents a renamed status, such as a file that has been renamed.
61 pub renamed: Hsla,
62 pub renamed_background: Hsla,
63 pub renamed_border: Hsla,
64
65 /// Indicates a successful operation or task completion.
66 pub success: Hsla,
67 pub success_background: Hsla,
68 pub success_border: Hsla,
69
70 /// Indicates some kind of unreachable status, like a block of code that can never be reached.
71 pub unreachable: Hsla,
72 pub unreachable_background: Hsla,
73 pub unreachable_border: Hsla,
74
75 /// Represents a warning status, like an operation that is about to fail.
76 pub warning: Hsla,
77 pub warning_background: Hsla,
78 pub warning_border: Hsla,
79}
80
81pub struct DiagnosticColors {
82 pub error: Hsla,
83 pub warning: Hsla,
84 pub info: Hsla,
85}
86
87pub struct GitStatusColors {
88 pub created: Hsla,
89 pub deleted: Hsla,
90 pub modified: Hsla,
91 pub renamed: Hsla,
92 pub conflict: Hsla,
93 pub ignored: Hsla,
94}
95
96impl StatusColors {
97 pub fn dark() -> Self {
98 Self {
99 conflict: red().dark().step_9(),
100 conflict_background: red().dark().step_9(),
101 conflict_border: red().dark().step_9(),
102 created: grass().dark().step_9(),
103 created_background: grass().dark().step_9(),
104 created_border: grass().dark().step_9(),
105 deleted: red().dark().step_9(),
106 deleted_background: red().dark().step_9(),
107 deleted_border: red().dark().step_9(),
108 error: red().dark().step_9(),
109 error_background: red().dark().step_9(),
110 error_border: red().dark().step_9(),
111 hidden: neutral().dark().step_9(),
112 hidden_background: neutral().dark().step_9(),
113 hidden_border: neutral().dark().step_9(),
114 hint: blue().dark().step_9(),
115 hint_background: blue().dark().step_9(),
116 hint_border: blue().dark().step_9(),
117 ignored: neutral().dark().step_9(),
118 ignored_background: neutral().dark().step_9(),
119 ignored_border: neutral().dark().step_9(),
120 info: blue().dark().step_9(),
121 info_background: blue().dark().step_9(),
122 info_border: blue().dark().step_9(),
123 modified: yellow().dark().step_9(),
124 modified_background: yellow().dark().step_9(),
125 modified_border: yellow().dark().step_9(),
126 predictive: neutral().dark_alpha().step_9(),
127 predictive_background: neutral().dark_alpha().step_9(),
128 predictive_border: neutral().dark_alpha().step_9(),
129 renamed: blue().dark().step_9(),
130 renamed_background: blue().dark().step_9(),
131 renamed_border: blue().dark().step_9(),
132 success: grass().dark().step_9(),
133 success_background: grass().dark().step_9(),
134 success_border: grass().dark().step_9(),
135 unreachable: neutral().dark().step_10(),
136 unreachable_background: neutral().dark().step_10(),
137 unreachable_border: neutral().dark().step_10(),
138 warning: yellow().dark().step_9(),
139 warning_background: yellow().dark().step_9(),
140 warning_border: yellow().dark().step_9(),
141 }
142 }
143
144 pub fn light() -> Self {
145 Self {
146 conflict: red().light().step_9(),
147 conflict_background: red().light().step_9(),
148 conflict_border: red().light().step_9(),
149 created: grass().light().step_9(),
150 created_background: grass().light().step_9(),
151 created_border: grass().light().step_9(),
152 deleted: red().light().step_9(),
153 deleted_background: red().light().step_9(),
154 deleted_border: red().light().step_9(),
155 error: red().light().step_9(),
156 error_background: red().light().step_9(),
157 error_border: red().light().step_9(),
158 hidden: neutral().light().step_9(),
159 hidden_background: neutral().light().step_9(),
160 hidden_border: neutral().light().step_9(),
161 hint: blue().light().step_9(),
162 hint_background: blue().light().step_9(),
163 hint_border: blue().light().step_9(),
164 ignored: neutral().light().step_9(),
165 ignored_background: neutral().light().step_9(),
166 ignored_border: neutral().light().step_9(),
167 info: blue().light().step_9(),
168 info_background: blue().light().step_9(),
169 info_border: blue().light().step_9(),
170 modified: yellow().light().step_9(),
171 modified_background: yellow().light().step_9(),
172 modified_border: yellow().light().step_9(),
173 predictive: neutral().light_alpha().step_9(),
174 predictive_background: neutral().light_alpha().step_9(),
175 predictive_border: neutral().light_alpha().step_9(),
176 renamed: blue().light().step_9(),
177 renamed_background: blue().light().step_9(),
178 renamed_border: blue().light().step_9(),
179 success: grass().light().step_9(),
180 success_background: grass().light().step_9(),
181 success_border: grass().light().step_9(),
182 unreachable: neutral().light().step_10(),
183 unreachable_background: neutral().light().step_10(),
184 unreachable_border: neutral().light().step_10(),
185 warning: yellow().light().step_9(),
186 warning_background: yellow().light().step_9(),
187 warning_border: yellow().light().step_9(),
188 }
189 }
190
191 pub fn diagnostic(&self) -> DiagnosticColors {
192 DiagnosticColors {
193 error: self.error,
194 warning: self.warning,
195 info: self.info,
196 }
197 }
198
199 pub fn git(&self) -> GitStatusColors {
200 GitStatusColors {
201 created: self.created,
202 deleted: self.deleted,
203 modified: self.modified,
204 renamed: self.renamed,
205 conflict: self.conflict,
206 ignored: self.ignored,
207 }
208 }
209}