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