Tweak color of share icon in titlebar

This commit is contained in:
Max Brunsfeld 2022-01-10 11:26:07 -08:00
parent 7244fe9c7f
commit c7eb6a6a60
3 changed files with 11 additions and 7 deletions

View file

@ -48,7 +48,8 @@ pub struct Titlebar {
pub avatar_width: f32, pub avatar_width: f32,
pub avatar_ribbon: AvatarRibbon, pub avatar_ribbon: AvatarRibbon,
pub offline_icon: OfflineIcon, pub offline_icon: OfflineIcon,
pub icon_color: Color, pub share_icon_color: Color,
pub share_icon_active_color: Color,
pub avatar: ImageStyle, pub avatar: ImageStyle,
pub sign_in_prompt: ContainedText, pub sign_in_prompt: ContainedText,
pub hovered_sign_in_prompt: ContainedText, pub hovered_sign_in_prompt: ContainedText,
@ -68,6 +69,7 @@ pub struct OfflineIcon {
#[serde(flatten)] #[serde(flatten)]
pub container: ContainerStyle, pub container: ContainerStyle,
pub width: f32, pub width: f32,
pub color: Color,
} }
#[derive(Clone, Deserialize, Default)] #[derive(Clone, Deserialize, Default)]

View file

@ -1074,7 +1074,7 @@ impl Workspace {
Align::new( Align::new(
ConstrainedBox::new( ConstrainedBox::new(
Svg::new("icons/offline-14.svg") Svg::new("icons/offline-14.svg")
.with_color(theme.workspace.titlebar.icon_color) .with_color(theme.workspace.titlebar.offline_icon.color)
.boxed(), .boxed(),
) )
.with_width(theme.workspace.titlebar.offline_icon.width) .with_width(theme.workspace.titlebar.offline_icon.width)
@ -1113,7 +1113,7 @@ impl Workspace {
.with_child( .with_child(
Align::new( Align::new(
Flex::row() 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_children(self.render_collaborators(theme, cx))
.with_child(self.render_avatar( .with_child(self.render_avatar(
self.user_store.read(cx).current_user().as_ref(), self.user_store.read(cx).current_user().as_ref(),
@ -1205,14 +1205,14 @@ impl Workspace {
} }
} }
fn render_share_icon(&self, cx: &mut RenderContext<Self>) -> Option<ElementBox> { fn render_share_icon(&self, theme: &Theme, cx: &mut RenderContext<Self>) -> Option<ElementBox> {
if self.project().read(cx).is_local() && self.client.user_id().is_some() { if self.project().read(cx).is_local() && self.client.user_id().is_some() {
enum Share {} enum Share {}
let color = if self.project().read(cx).is_shared() { let color = if self.project().read(cx).is_shared() {
Color::green() theme.workspace.titlebar.share_icon_active_color
} else { } else {
Color::red() theme.workspace.titlebar.share_icon_color
}; };
Some( Some(
MouseEventHandler::new::<Share, _, _, _>(0, cx, |_, _| { MouseEventHandler::new::<Share, _, _, _>(0, cx, |_, _| {

View file

@ -12,8 +12,9 @@ title = "$text.0"
avatar_width = 18 avatar_width = 18
avatar = { corner_radius = 10, border = { width = 1, color = "#00000088" } } avatar = { corner_radius = 10, border = { width = 1, color = "#00000088" } }
avatar_ribbon = { background = "#ff0000", height = 3, width = 12 } avatar_ribbon = { background = "#ff0000", height = 3, width = 12 }
icon_color = "$text.2.color"
outdated_warning = { extends = "$text.2", size = 13 } 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] [workspace.titlebar.sign_in_prompt]
extends = "$text.2" extends = "$text.2"
@ -28,6 +29,7 @@ color = "$text.1.color"
[workspace.titlebar.offline_icon] [workspace.titlebar.offline_icon]
padding = { right = 4 } padding = { right = 4 }
width = 16 width = 16
color = "$text.2.color"
[workspace.tab] [workspace.tab]
height = 34 height = 34