From c7eb6a6a605d86f69fdbe4b3c8153d19f6ba8146 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 10 Jan 2022 11:26:07 -0800 Subject: [PATCH] Tweak color of share icon in titlebar --- crates/theme/src/theme.rs | 4 +++- crates/workspace/src/workspace.rs | 10 +++++----- crates/zed/assets/themes/_base.toml | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 1ba2fc8faf85e1f83fbe088d8f66ac693ec8c635..dcd378dcc5b552e24e360f3ad77f1a350d930fed 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -48,7 +48,8 @@ pub struct Titlebar { pub avatar_width: f32, pub avatar_ribbon: AvatarRibbon, pub offline_icon: OfflineIcon, - pub icon_color: Color, + pub share_icon_color: Color, + pub share_icon_active_color: Color, pub avatar: ImageStyle, pub sign_in_prompt: ContainedText, pub hovered_sign_in_prompt: ContainedText, @@ -68,6 +69,7 @@ pub struct OfflineIcon { #[serde(flatten)] pub container: ContainerStyle, pub width: f32, + pub color: Color, } #[derive(Clone, Deserialize, Default)] diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index ea6eb6603140108238ff916e605fb787451e12f3..b1eb97ec27344de88d1364322db412336a0ced13 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -1074,7 +1074,7 @@ impl Workspace { Align::new( ConstrainedBox::new( Svg::new("icons/offline-14.svg") - .with_color(theme.workspace.titlebar.icon_color) + .with_color(theme.workspace.titlebar.offline_icon.color) .boxed(), ) .with_width(theme.workspace.titlebar.offline_icon.width) @@ -1113,7 +1113,7 @@ impl Workspace { .with_child( Align::new( Flex::row() - .with_children(self.render_share_icon(cx)) + .with_children(self.render_share_icon(theme, cx)) .with_children(self.render_collaborators(theme, cx)) .with_child(self.render_avatar( self.user_store.read(cx).current_user().as_ref(), @@ -1205,14 +1205,14 @@ impl Workspace { } } - fn render_share_icon(&self, cx: &mut RenderContext) -> Option { + fn render_share_icon(&self, theme: &Theme, cx: &mut RenderContext) -> Option { if self.project().read(cx).is_local() && self.client.user_id().is_some() { enum Share {} let color = if self.project().read(cx).is_shared() { - Color::green() + theme.workspace.titlebar.share_icon_active_color } else { - Color::red() + theme.workspace.titlebar.share_icon_color }; Some( MouseEventHandler::new::(0, cx, |_, _| { diff --git a/crates/zed/assets/themes/_base.toml b/crates/zed/assets/themes/_base.toml index a8a5694978aca9d9207f1bd2a84f9b11fb4cf695..f24a6997bafe21fcfd9f5d335f2289f0f7ab3edb 100644 --- a/crates/zed/assets/themes/_base.toml +++ b/crates/zed/assets/themes/_base.toml @@ -12,8 +12,9 @@ title = "$text.0" avatar_width = 18 avatar = { corner_radius = 10, border = { width = 1, color = "#00000088" } } avatar_ribbon = { background = "#ff0000", height = 3, width = 12 } -icon_color = "$text.2.color" outdated_warning = { extends = "$text.2", size = 13 } +share_icon_color = "$text.2.color" +share_icon_active_color = "$text.0.color" [workspace.titlebar.sign_in_prompt] extends = "$text.2" @@ -28,6 +29,7 @@ color = "$text.1.color" [workspace.titlebar.offline_icon] padding = { right = 4 } width = 16 +color = "$text.2.color" [workspace.tab] height = 34