Skip to content

Commit d011b97

Browse files
authored
project_panel: Adjust entry background and border colors (#23403)
Follow up to #22658 This PR ensures the background and border color of a project panel entry is exactly the same with one exception: if the item is focused, active, and not with mouse down. The point is to not be able to see the border at all given they're there to act sort of akin to CSS's `outline` (which doesn't add up to the box model). Please let me know if there is any edge case I either messed up here or didn't account for. https://github.com/user-attachments/assets/29c74f6a-b027-4d19-a7de-b9614f0d7859 Release Notes: - N/A
1 parent f33d02c commit d011b97

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

crates/project_panel/src/project_panel.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ fn get_item_color(cx: &ViewContext<ProjectPanel>) -> ItemColors {
270270
default: colors.panel_background,
271271
hover: colors.ghost_element_hover,
272272
drag_over: colors.drop_target_background,
273-
marked_active: colors.ghost_element_selected,
273+
marked_active: colors.element_selected,
274274
focused: colors.panel_focused_border,
275275
}
276276
}
@@ -3274,13 +3274,13 @@ impl ProjectPanel {
32743274
marked_selections: selections,
32753275
};
32763276

3277-
let default_color = if is_marked {
3277+
let bg_color = if is_marked || is_active {
32783278
item_colors.marked_active
32793279
} else {
32803280
item_colors.default
32813281
};
32823282

3283-
let bg_hover_color = if self.mouse_down || is_marked {
3283+
let bg_hover_color = if self.mouse_down || is_marked || is_active {
32843284
item_colors.marked_active
32853285
} else if !is_active {
32863286
item_colors.hover
@@ -3291,22 +3291,27 @@ impl ProjectPanel {
32913291
let border_color =
32923292
if !self.mouse_down && is_active && self.focus_handle.contains_focused(cx) {
32933293
item_colors.focused
3294-
} else if self.mouse_down && is_marked || is_active {
3295-
item_colors.marked_active
32963294
} else {
3297-
item_colors.default
3295+
bg_color
3296+
};
3297+
3298+
let border_hover_color =
3299+
if !self.mouse_down && is_active && self.focus_handle.contains_focused(cx) {
3300+
item_colors.focused
3301+
} else {
3302+
bg_hover_color
32983303
};
32993304

33003305
div()
33013306
.id(entry_id.to_proto() as usize)
33023307
.group(GROUP_NAME)
33033308
.cursor_pointer()
33043309
.rounded_none()
3305-
.bg(default_color)
3310+
.bg(bg_color)
33063311
.border_1()
33073312
.border_r_2()
33083313
.border_color(border_color)
3309-
.hover(|style| style.bg(bg_hover_color))
3314+
.hover(|style| style.bg(bg_hover_color).border_color(border_hover_color))
33103315
.when(is_local, |div| {
33113316
div.on_drag_move::<ExternalPaths>(cx.listener(
33123317
move |this, event: &DragMoveEvent<ExternalPaths>, cx| {
@@ -3532,7 +3537,7 @@ impl ProjectPanel {
35323537
} else {
35333538
IconDecorationKind::Dot
35343539
},
3535-
default_color,
3540+
bg_color,
35363541
cx,
35373542
)
35383543
.group_name(Some(GROUP_NAME.into()))

crates/theme/src/default_colors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl ThemeColors {
165165
tab_active_background: neutral().dark().step_1(),
166166
search_match_background: neutral().dark().step_5(),
167167
panel_background: neutral().dark().step_2(),
168-
panel_focused_border: blue().dark().step_12(),
168+
panel_focused_border: blue().dark().step_8(),
169169
panel_indent_guide: neutral().dark_alpha().step_4(),
170170
panel_indent_guide_hover: neutral().dark_alpha().step_6(),
171171
panel_indent_guide_active: neutral().dark_alpha().step_6(),

0 commit comments

Comments
 (0)