1use ::settings::Settings;
2use git::repository::GitFileStatus;
3use gpui::{actions, AppContext, Hsla};
4use settings::GitPanelSettings;
5use ui::{Color, Icon, IconName, IntoElement};
6
7pub mod git_panel;
8mod settings;
9
10actions!(
11 git_ui,
12 [
13 StageAll,
14 UnstageAll,
15 DiscardAll,
16 CommitStagedChanges,
17 CommitAllChanges
18 ]
19);
20
21pub fn init(cx: &mut AppContext) {
22 GitPanelSettings::register(cx);
23}
24
25const ADDED_COLOR: Hsla = Hsla {
26 h: 142. / 360.,
27 s: 0.68,
28 l: 0.45,
29 a: 1.0,
30};
31const MODIFIED_COLOR: Hsla = Hsla {
32 h: 48. / 360.,
33 s: 0.76,
34 l: 0.47,
35 a: 1.0,
36};
37const REMOVED_COLOR: Hsla = Hsla {
38 h: 355. / 360.,
39 s: 0.65,
40 l: 0.65,
41 a: 1.0,
42};
43
44// TODO: Add updated status colors to theme
45pub fn git_status_icon(status: GitFileStatus) -> impl IntoElement {
46 match status {
47 GitFileStatus::Added => Icon::new(IconName::SquarePlus).color(Color::Custom(ADDED_COLOR)),
48 GitFileStatus::Modified => {
49 Icon::new(IconName::SquareDot).color(Color::Custom(MODIFIED_COLOR))
50 }
51 GitFileStatus::Conflict => Icon::new(IconName::Warning).color(Color::Custom(REMOVED_COLOR)),
52 }
53}