1use ::settings::Settings;
2use git::status::FileStatus;
3use git_panel_settings::GitPanelSettings;
4use gpui::{AppContext, Hsla};
5use ui::{Color, Icon, IconName, IntoElement};
6
7pub mod git_panel;
8mod git_panel_settings;
9
10pub fn init(cx: &mut AppContext) {
11 GitPanelSettings::register(cx);
12}
13
14const ADDED_COLOR: Hsla = Hsla {
15 h: 142. / 360.,
16 s: 0.68,
17 l: 0.45,
18 a: 1.0,
19};
20const MODIFIED_COLOR: Hsla = Hsla {
21 h: 48. / 360.,
22 s: 0.76,
23 l: 0.47,
24 a: 1.0,
25};
26const REMOVED_COLOR: Hsla = Hsla {
27 h: 355. / 360.,
28 s: 0.65,
29 l: 0.65,
30 a: 1.0,
31};
32
33// TODO: Add updated status colors to theme
34pub fn git_status_icon(status: FileStatus) -> impl IntoElement {
35 let (icon_name, color) = if status.is_conflicted() {
36 (IconName::Warning, REMOVED_COLOR)
37 } else if status.is_deleted() {
38 (IconName::SquareMinus, REMOVED_COLOR)
39 } else if status.is_modified() {
40 (IconName::SquareDot, MODIFIED_COLOR)
41 } else {
42 (IconName::SquarePlus, ADDED_COLOR)
43 };
44 Icon::new(icon_name).color(Color::Custom(color))
45}