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_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)]

View file

@ -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<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() {
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::<Share, _, _, _>(0, cx, |_, _| {

View file

@ -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