From 0511768b226094a25fddb99fc6e7ef53ad220197 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Thu, 5 Dec 2024 19:17:26 -0300 Subject: [PATCH] project panel: Use theme token for focused border color (#21593) Closes https://github.com/zed-industries/zed/issues/12723 This PR makes the border color of a focused project panel item use the `panel_focused_border` theme token. This allow theme makers to customize that independently of the `text_accent` color, which was the one being previously used. ### One Dark | Before | After | |--------|--------| | Screenshot 2024-12-05 at 18 37 00 | Screenshot 2024-12-05 at 18 39 42 | | Screenshot 2024-12-05 at 18 37 08 | Screenshot 2024-12-05 at 18 39 51 | ### Gruvbox Hard | Before | After | |--------|--------| | Screenshot 2024-12-05 at 18 38 05 | Screenshot 2024-12-05 at 18 40 15 | | Screenshot 2024-12-05 at 18 38 16 | Screenshot 2024-12-05 at 18 39 57 | Release Notes: - N/A --- crates/project_panel/src/project_panel.rs | 4 +++- crates/theme/src/default_colors.rs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index d263c75ca7c2208de685ab3da191c883816c94a9..ca6f89f69a0d4884e643545c19f7bc309be60603 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -261,6 +261,7 @@ struct ItemColors { hover: Hsla, drag_over: Hsla, marked_active: Hsla, + focused: Hsla, } fn get_item_color(cx: &ViewContext) -> ItemColors { @@ -271,6 +272,7 @@ fn get_item_color(cx: &ViewContext) -> ItemColors { hover: colors.ghost_element_hover, drag_over: colors.drop_target_background, marked_active: colors.ghost_element_selected, + focused: colors.panel_focused_border, } } @@ -3504,7 +3506,7 @@ impl ProjectPanel { .rounded_none() .when( !self.mouse_down && is_active && self.focus_handle.contains_focused(cx), - |this| this.border_color(Color::Selected.color(cx)), + |this| this.border_color(item_colors.focused), ) } diff --git a/crates/theme/src/default_colors.rs b/crates/theme/src/default_colors.rs index 05dd6cd1e74fd3b78a9cd42b7130df973624f1af..b9780a304ad348cdc1f9270be78cf0de929f39d6 100644 --- a/crates/theme/src/default_colors.rs +++ b/crates/theme/src/default_colors.rs @@ -58,7 +58,7 @@ impl ThemeColors { tab_active_background: neutral().light().step_1(), search_match_background: neutral().light().step_5(), panel_background: neutral().light().step_2(), - panel_focused_border: blue().light().step_5(), + panel_focused_border: blue().light().step_10(), panel_indent_guide: neutral().light_alpha().step_5(), panel_indent_guide_hover: neutral().light_alpha().step_6(), panel_indent_guide_active: neutral().light_alpha().step_6(), @@ -164,7 +164,7 @@ impl ThemeColors { tab_active_background: neutral().dark().step_1(), search_match_background: neutral().dark().step_5(), panel_background: neutral().dark().step_2(), - panel_focused_border: blue().dark().step_5(), + panel_focused_border: blue().dark().step_12(), panel_indent_guide: neutral().dark_alpha().step_4(), panel_indent_guide_hover: neutral().dark_alpha().step_6(), panel_indent_guide_active: neutral().dark_alpha().step_6(),