diff --git a/zed/assets/themes/_base.toml b/zed/assets/themes/_base.toml index cf340282d5287f3833bee7809f45b8e3e9717c1c..021ba25789f2da4e0434a8d34bb2c39138c62c95 100644 --- a/zed/assets/themes/_base.toml +++ b/zed/assets/themes/_base.toml @@ -1,25 +1,25 @@ [workspace] background = "$surface.0" -[tab] +[workspace.tab] text = "$text.2" padding = { left = 10, right = 10 } icon_close = "$text.0" icon_dirty = "$status.info" icon_conflict = "$status.warn" -[active_tab] +[workspace.active_tab] extends = "$tab" background = "$surface.1" text = "$text.0" -[sidebar] +[workspace.sidebar] padding = { left = 10, right = 10 } -[sidebar_icon] +[workspace.sidebar_icon] color = "$text.2" -[active_sidebar_icon] +[workspace.active_sidebar_icon] color = "$text.0" [selector] diff --git a/zed/src/theme.rs b/zed/src/theme.rs index f2425b5e2f33389f7896c1829bcde0776f9d47fd..c99cd0e39cc30cdebaf0d2feef556215d1cfbb86 100644 --- a/zed/src/theme.rs +++ b/zed/src/theme.rs @@ -20,11 +20,6 @@ pub struct Theme { #[serde(default)] pub name: String, pub workspace: Workspace, - pub tab: Tab, - pub active_tab: Tab, - pub sidebar: ContainerStyle, - pub sidebar_icon: SidebarIcon, - pub active_sidebar_icon: SidebarIcon, pub selector: Selector, pub editor: Editor, #[serde(deserialize_with = "deserialize_syntax_theme")] @@ -34,6 +29,11 @@ pub struct Theme { #[derive(Debug, Default, Deserialize)] pub struct Workspace { pub background: Color, + pub tab: Tab, + pub active_tab: Tab, + pub sidebar: ContainerStyle, + pub sidebar_icon: SidebarIcon, + pub active_sidebar_icon: SidebarIcon, } #[derive(Debug, Deserialize)] diff --git a/zed/src/workspace/pane.rs b/zed/src/workspace/pane.rs index 845f6e2521fdf367c6e7dc9496bca2ecdbd3aab9..ab74cac19148e40745032ab283ea0168e016a220 100644 --- a/zed/src/workspace/pane.rs +++ b/zed/src/workspace/pane.rs @@ -189,7 +189,7 @@ impl Pane { let is_active = ix == self.active_item; enum Tab {} - let border = &theme.tab.container.border; + let border = &theme.workspace.tab.container.border; row.add_child( Expanded::new( @@ -212,9 +212,9 @@ impl Pane { settings.ui_font_size, ) .with_style(if is_active { - &theme.active_tab.label + &theme.workspace.active_tab.label } else { - &theme.tab.label + &theme.workspace.tab.label }) .boxed(), ) @@ -236,9 +236,9 @@ impl Pane { .boxed(), ) .with_style(if is_active { - &theme.active_tab.container + &theme.workspace.active_tab.container } else { - &theme.tab.container + &theme.workspace.tab.container }) .with_border(border); @@ -267,7 +267,7 @@ impl Pane { // Ensure there's always a minimum amount of space after the last tab, // so that the tab's border doesn't abut the window's border. let mut border = Border::bottom(1.0, Color::default()); - border.color = theme.tab.container.border.color; + border.color = theme.workspace.tab.container.border.color; row.add_child( ConstrainedBox::new( @@ -305,19 +305,19 @@ impl Pane { ) -> ElementBox { enum TabCloseButton {} - let mut clicked_color = theme.tab.icon_dirty; + let mut clicked_color = theme.workspace.tab.icon_dirty; clicked_color.a = 180; let current_color = if has_conflict { - Some(theme.tab.icon_conflict) + Some(theme.workspace.tab.icon_conflict) } else if is_dirty { - Some(theme.tab.icon_dirty) + Some(theme.workspace.tab.icon_dirty) } else { None }; let icon = if tab_hovered { - let close_color = current_color.unwrap_or(theme.tab.icon_close); + let close_color = current_color.unwrap_or(theme.workspace.tab.icon_close); let icon = Svg::new("icons/x.svg").with_color(close_color); MouseEventHandler::new::(item_id, cx, |mouse_state| { @@ -326,7 +326,7 @@ impl Pane { .with_background_color(if mouse_state.clicked { clicked_color } else { - theme.tab.icon_dirty + theme.workspace.tab.icon_dirty }) .with_corner_radius(close_icon_size / 2.) .boxed() diff --git a/zed/src/workspace/sidebar.rs b/zed/src/workspace/sidebar.rs index 81807fd01a5ca621da7575065152b6cc14730cb0..8bb3f06fc1a013c8a59688e54aba0daee52446a6 100644 --- a/zed/src/workspace/sidebar.rs +++ b/zed/src/workspace/sidebar.rs @@ -70,9 +70,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.active_sidebar_icon + &settings.theme.workspace.active_sidebar_icon } else { - &settings.theme.sidebar_icon + &settings.theme.workspace.sidebar_icon }; enum SidebarButton {} MouseEventHandler::new::(item.view.id(), cx, |_| { @@ -96,7 +96,7 @@ impl Sidebar { })) .boxed(), ) - .with_style(&settings.theme.sidebar) + .with_style(&settings.theme.workspace.sidebar) .boxed() } }