Set sidebar icon heights via theme

Nathan Sobo and Max Brunsfeld created

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>

Change summary

zed/assets/themes/_base.toml | 9 +++++++--
zed/src/theme.rs             | 5 +++--
zed/src/workspace/sidebar.rs | 6 +++---
3 files changed, 13 insertions(+), 7 deletions(-)

Detailed changes

zed/assets/themes/_base.toml 🔗

@@ -1,3 +1,6 @@
+[text]
+base = { family = "Inconsolata", size = 14 }
+
 [workspace]
 background = "$surface.0"
 
@@ -19,10 +22,12 @@ padding = { left = 10, right = 10 }
 [workspace.sidebar.resize_handle]
 margin = { left = 6 }
 
-[workspace.sidebar_icon]
+[workspace.sidebar.icon]
 color = "$text.2.color"
+height = 18
 
-[workspace.active_sidebar_icon]
+[workspace.sidebar.active_icon]
+extends = "$workspace.sidebar.icon"
 color = "$text.0.color"
 
 [chat_panel]

zed/src/theme.rs 🔗

@@ -36,8 +36,6 @@ pub struct Workspace {
     pub tab: Tab,
     pub active_tab: Tab,
     pub sidebar: Sidebar,
-    pub sidebar_icon: SidebarIcon,
-    pub active_sidebar_icon: SidebarIcon,
 }
 
 #[derive(Deserialize)]
@@ -54,12 +52,15 @@ pub struct Tab {
 #[derive(Deserialize)]
 pub struct Sidebar {
     pub icons: ContainerStyle,
+    pub icon: SidebarIcon,
+    pub active_icon: SidebarIcon,
     pub resize_handle: ContainerStyle,
 }
 
 #[derive(Deserialize)]
 pub struct SidebarIcon {
     pub color: Color,
+    pub height: f32,
 }
 
 #[derive(Deserialize)]

zed/src/workspace/sidebar.rs 🔗

@@ -71,9 +71,9 @@ impl Sidebar {
             Flex::column()
                 .with_children(self.items.iter().enumerate().map(|(item_index, item)| {
                     let theme = if Some(item_index) == self.active_item_ix {
-                        &settings.theme.workspace.active_sidebar_icon
+                        &settings.theme.workspace.sidebar.active_icon
                     } else {
-                        &settings.theme.workspace.sidebar_icon
+                        &settings.theme.workspace.sidebar.icon
                     };
                     enum SidebarButton {}
                     MouseEventHandler::new::<SidebarButton, _, _, _>(item.view.id(), cx, |_, _| {
@@ -82,7 +82,7 @@ impl Sidebar {
                                 ConstrainedBox::new(
                                     Svg::new(item.icon_path).with_color(theme.color).boxed(),
                                 )
-                                .with_height(line_height)
+                                .with_height(theme.height)
                                 .boxed(),
                             )
                             .boxed(),