diff --git a/zed/assets/themes/_base.toml b/zed/assets/themes/_base.toml index a6663ec9c3..2ad222c174 100644 --- a/zed/assets/themes/_base.toml +++ b/zed/assets/themes/_base.toml @@ -1,7 +1,7 @@ -[ui] +[workspace] background = "$surface.0" -[ui.tab] +[tab] background = "$surface.1" text = "$text_color.dull" border = { color = "#000000", width = 1.0 } @@ -10,12 +10,12 @@ icon_close = "#383839" icon_dirty = "#556de8" icon_conflict = "#e45349" -[ui.active_tab] -extends = "$ui.tab" +[active_tab] +extends = "$tab" background = "$surface.2" text = "$text_color.bright" -[ui.selector] +[selector] background = "$surface.3" text = "$text_color.bright" padding = { top = 6.0, bottom = 6.0, left = 6.0, right = 6.0 } @@ -23,15 +23,15 @@ margin.top = 12.0 corner_radius = 6.0 shadow = { offset = [0.0, 0.0], blur = 12.0, color = "#00000088" } -[ui.selector.item] +[selector.item] background = "#424344" text = "#cccccc" highlight_text = { color = "#18a3ff", weight = "bold" } border = { color = "#000000", width = 1.0 } padding = { top = 6.0, bottom = 6.0, left = 6.0, right = 6.0 } -[ui.selector.active_item] -extends = "$ui.selector.item" +[selector.active_item] +extends = "$selector.item" background = "#094771" [editor] diff --git a/zed/src/file_finder.rs b/zed/src/file_finder.rs index 7c9900c3f4..d370f85a08 100644 --- a/zed/src/file_finder.rs +++ b/zed/src/file_finder.rs @@ -75,7 +75,7 @@ impl View for FileFinder { .with_child(Expanded::new(1.0, self.render_matches()).boxed()) .boxed(), ) - .with_style(&settings.theme.ui.selector.container) + .with_style(&settings.theme.selector.container) .boxed(), ) .with_max_width(600.0) @@ -107,7 +107,7 @@ impl FileFinder { settings.ui_font_family, settings.ui_font_size, ) - .with_style(&settings.theme.ui.selector.label) + .with_style(&settings.theme.selector.label) .boxed(), ) .with_margin_top(6.0) @@ -142,9 +142,9 @@ impl FileFinder { let selected_index = self.selected_index(); let settings = self.settings.borrow(); let style = if index == selected_index { - &settings.theme.ui.selector.active_item + &settings.theme.selector.active_item } else { - &settings.theme.ui.selector.item + &settings.theme.selector.item }; let (file_name, file_name_positions, full_path, full_path_positions) = self.labels_for_match(path_match); diff --git a/zed/src/theme.rs b/zed/src/theme.rs index 39412804d8..52b87860c7 100644 --- a/zed/src/theme.rs +++ b/zed/src/theme.rs @@ -30,18 +30,18 @@ pub struct HighlightId(u32); pub struct Theme { #[serde(default)] pub name: String, - pub ui: Ui, + pub workspace: Workspace, + pub tab: Tab, + pub active_tab: Tab, + pub selector: Selector, pub editor: Editor, #[serde(deserialize_with = "deserialize_syntax_theme")] pub syntax: Vec<(String, TextStyle)>, } #[derive(Debug, Default, Deserialize)] -pub struct Ui { +pub struct Workspace { pub background: Color, - pub tab: Tab, - pub active_tab: Tab, - pub selector: Selector, } #[derive(Debug, Deserialize)] @@ -800,8 +800,6 @@ mod tests { fn test_highlight_map() { let theme = Theme { name: "test".into(), - ui: Default::default(), - editor: Default::default(), syntax: [ ("function", Color::from_u32(0x100000ff)), ("function.method", Color::from_u32(0x200000ff)), @@ -813,6 +811,7 @@ mod tests { .iter() .map(|(name, color)| (name.to_string(), (*color).into())) .collect(), + ..Default::default() }; let capture_names = &[ diff --git a/zed/src/theme_selector.rs b/zed/src/theme_selector.rs index 25816a41d2..2853f938fa 100644 --- a/zed/src/theme_selector.rs +++ b/zed/src/theme_selector.rs @@ -207,7 +207,7 @@ impl ThemeSelector { settings.ui_font_family, settings.ui_font_size, ) - .with_style(&settings.theme.ui.selector.label) + .with_style(&settings.theme.selector.label) .boxed(), ) .with_margin_top(6.0) @@ -240,7 +240,7 @@ impl ThemeSelector { fn render_match(&self, theme_match: &StringMatch, index: usize) -> ElementBox { let settings = self.settings.borrow(); - let theme = &settings.theme.ui; + let theme = &settings.theme; let container = Container::new( Label::new( @@ -286,7 +286,7 @@ impl View for ThemeSelector { .with_child(Expanded::new(1.0, self.render_matches(cx)).boxed()) .boxed(), ) - .with_style(&settings.theme.ui.selector.container) + .with_style(&settings.theme.selector.container) .boxed(), ) .with_max_width(600.0) diff --git a/zed/src/workspace.rs b/zed/src/workspace.rs index 663ca5f75e..55f9efd75a 100644 --- a/zed/src/workspace.rs +++ b/zed/src/workspace.rs @@ -885,7 +885,7 @@ impl View for Workspace { .with_children(self.modal.as_ref().map(|m| ChildView::new(m.id()).boxed())) .boxed(), ) - .with_background_color(settings.theme.ui.background) + .with_background_color(settings.theme.workspace.background) .named("workspace") } diff --git a/zed/src/workspace/pane.rs b/zed/src/workspace/pane.rs index 511e48dfd4..f99e2a3fd6 100644 --- a/zed/src/workspace/pane.rs +++ b/zed/src/workspace/pane.rs @@ -181,7 +181,7 @@ impl Pane { fn render_tabs(&self, cx: &AppContext) -> ElementBox { let settings = self.settings.borrow(); - let theme = &settings.theme.ui; + let theme = &settings.theme; let line_height = cx.font_cache().line_height( cx.font_cache().default_font(settings.ui_font_family), settings.ui_font_size, @@ -304,7 +304,7 @@ impl Pane { tab_hovered: bool, is_dirty: bool, has_conflict: bool, - theme: &theme::Ui, + theme: &theme::Theme, cx: &AppContext, ) -> ElementBox { enum TabCloseButton {}