
This PR adds version control-specific theme tokens to the them to allow styling entries in the git ui and elsewhere. Release Notes: - N/A
39 lines
1.1 KiB
Rust
39 lines
1.1 KiB
Rust
use ::settings::Settings;
|
|
use git::status::FileStatus;
|
|
use git_panel_settings::GitPanelSettings;
|
|
use gpui::AppContext;
|
|
use ui::{ActiveTheme, Color, Icon, IconName, IntoElement, WindowContext};
|
|
|
|
pub mod git_panel;
|
|
mod git_panel_settings;
|
|
pub mod repository_selector;
|
|
|
|
pub fn init(cx: &mut AppContext) {
|
|
GitPanelSettings::register(cx);
|
|
}
|
|
|
|
// TODO: Add updated status colors to theme
|
|
pub fn git_status_icon(status: FileStatus, cx: &WindowContext) -> impl IntoElement {
|
|
let (icon_name, color) = if status.is_conflicted() {
|
|
(
|
|
IconName::Warning,
|
|
cx.theme().colors().version_control_conflict,
|
|
)
|
|
} else if status.is_deleted() {
|
|
(
|
|
IconName::SquareMinus,
|
|
cx.theme().colors().version_control_deleted,
|
|
)
|
|
} else if status.is_modified() {
|
|
(
|
|
IconName::SquareDot,
|
|
cx.theme().colors().version_control_modified,
|
|
)
|
|
} else {
|
|
(
|
|
IconName::SquarePlus,
|
|
cx.theme().colors().version_control_added,
|
|
)
|
|
};
|
|
Icon::new(icon_name).color(Color::Custom(color))
|
|
}
|