Skip to main content

boltz_theme/styles/
status.rs

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
89impl StatusColors {
90    pub fn dark() -> Self {
91        Self {
92            conflict: red().dark().step_9(),
93            conflict_background: red().dark().step_9(),
94            conflict_border: red().dark().step_9(),
95            created: grass().dark().step_9(),
96            created_background: grass().dark().step_9().opacity(0.25),
97            created_border: grass().dark().step_9(),
98            deleted: red().dark().step_9(),
99            deleted_background: red().dark().step_9().opacity(0.25),
100            deleted_border: red().dark().step_9(),
101            error: red().dark().step_9(),
102            error_background: red().dark().step_9(),
103            error_border: red().dark().step_9(),
104            hidden: neutral().dark().step_9(),
105            hidden_background: neutral().dark().step_9(),
106            hidden_border: neutral().dark().step_9(),
107            hint: blue().dark().step_9(),
108            hint_background: blue().dark().step_9(),
109            hint_border: blue().dark().step_9(),
110            ignored: neutral().dark().step_9(),
111            ignored_background: neutral().dark().step_9(),
112            ignored_border: neutral().dark().step_9(),
113            info: blue().dark().step_9(),
114            info_background: blue().dark().step_9(),
115            info_border: blue().dark().step_9(),
116            modified: yellow().dark().step_9(),
117            modified_background: yellow().dark().step_9().opacity(0.25),
118            modified_border: yellow().dark().step_9(),
119            predictive: neutral().dark_alpha().step_9(),
120            predictive_background: neutral().dark_alpha().step_9(),
121            predictive_border: neutral().dark_alpha().step_9(),
122            renamed: blue().dark().step_9(),
123            renamed_background: blue().dark().step_9(),
124            renamed_border: blue().dark().step_9(),
125            success: grass().dark().step_9(),
126            success_background: grass().dark().step_9(),
127            success_border: grass().dark().step_9(),
128            unreachable: neutral().dark().step_10(),
129            unreachable_background: neutral().dark().step_10(),
130            unreachable_border: neutral().dark().step_10(),
131            warning: yellow().dark().step_9(),
132            warning_background: yellow().dark().step_9(),
133            warning_border: yellow().dark().step_9(),
134        }
135    }
136
137    pub fn light() -> Self {
138        Self {
139            conflict: red().light().step_9(),
140            conflict_background: red().light().step_9(),
141            conflict_border: red().light().step_9(),
142            created: grass().light().step_9(),
143            created_background: grass().light().step_9(),
144            created_border: grass().light().step_9(),
145            deleted: red().light().step_9(),
146            deleted_background: red().light().step_9(),
147            deleted_border: red().light().step_9(),
148            error: red().light().step_9(),
149            error_background: red().light().step_9(),
150            error_border: red().light().step_9(),
151            hidden: neutral().light().step_9(),
152            hidden_background: neutral().light().step_9(),
153            hidden_border: neutral().light().step_9(),
154            hint: blue().light().step_9(),
155            hint_background: blue().light().step_9(),
156            hint_border: blue().light().step_9(),
157            ignored: neutral().light().step_9(),
158            ignored_background: neutral().light().step_9(),
159            ignored_border: neutral().light().step_9(),
160            info: blue().light().step_9(),
161            info_background: blue().light().step_9(),
162            info_border: blue().light().step_9(),
163            modified: yellow().light().step_9(),
164            modified_background: yellow().light().step_9(),
165            modified_border: yellow().light().step_9(),
166            predictive: neutral().light_alpha().step_9(),
167            predictive_background: neutral().light_alpha().step_9(),
168            predictive_border: neutral().light_alpha().step_9(),
169            renamed: blue().light().step_9(),
170            renamed_background: blue().light().step_9(),
171            renamed_border: blue().light().step_9(),
172            success: grass().light().step_9(),
173            success_background: grass().light().step_9(),
174            success_border: grass().light().step_9(),
175            unreachable: neutral().light().step_10(),
176            unreachable_background: neutral().light().step_10(),
177            unreachable_border: neutral().light().step_10(),
178            warning: yellow().light().step_9(),
179            warning_background: yellow().light().step_9(),
180            warning_border: yellow().light().step_9(),
181        }
182    }
183
184    pub fn diagnostic(&self) -> DiagnosticColors {
185        DiagnosticColors {
186            error: self.error,
187            warning: self.warning,
188            info: self.info,
189        }
190    }
191}