Skip to content

Commit 80e4784

Browse files
committed
Make the pin button's hover fill visible on selected pills
`fg_overlay_1` is the theme foreground at 5% opacity, and a selected pill's background is that same foreground colour at full opacity. Hovering the pin button on a selected chip therefore painted a colour onto itself and produced no visual change at all. That is not an edge case: `drill_down_anchor_id` anchors the bar on the parent of whatever leaf conversation you are viewing, so the active child renders as a selected, pinnable child pill. Selected-and-hovered is the state users are in most of the time. Tint with the pill's own contrasting colour instead -- the one it already computes for its text and icons, which flips with selection -- so the fill has contrast in both states. 8% rather than 5% because the contrasting colour starts further from the pill's background than the foreground overlay did. Co-Authored-By: Warp Agent <agent@warp.dev>
1 parent 952c413 commit 80e4784

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

app/src/ai/blocklist/agent_view/orchestration_pill_bar.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,11 +1996,16 @@ fn render_pin_button(
19961996
icon_color: ColorU,
19971997
mouse_state: MouseStateHandle,
19981998
conversation_id: AIConversationId,
1999-
theme: &WarpTheme,
20001999
appearance: &Appearance,
20012000
app: &AppContext,
20022001
) -> Box<dyn Element> {
2003-
let hover_background = internal_colors::fg_overlay_1(theme);
2002+
// Tint with the pill's own contrasting colour rather than a fixed
2003+
// foreground overlay. `fg_overlay_1` is the foreground at 5% opacity, and a
2004+
// selected pill's background *is* the foreground colour, so the old fill
2005+
// painted a colour onto itself and the hover state was invisible on every
2006+
// selected chip — which, since the bar anchors on the parent of whatever
2007+
// leaf you are viewing, is the common case rather than an edge case.
2008+
let hover_background = coloru_with_opacity(icon_color, PIN_BUTTON_HOVER_OPACITY);
20042009
let glyph_ink_height = avatar_letter_ink_height(PILL_AVATAR_DISC_SIZE, appearance, app);
20052010
let button = Hoverable::new(mouse_state, move |hover_state| {
20062011
let mut circle = Container::new(render_pin_glyph(is_pinned, icon_color, glyph_ink_height))
@@ -2177,7 +2182,6 @@ fn render_pill(
21772182
text_color,
21782183
pin_button_mouse_state.clone(),
21792184
conversation_id,
2180-
theme,
21812185
appearance,
21822186
app,
21832187
)
@@ -2391,6 +2395,11 @@ fn render_overflow_button(
23912395
SavePosition::new(button, &overflow_button_position_id(conversation_id)).finish()
23922396
}
23932397

2398+
/// Opacity of the pin button's hover tint, over the pill's contrasting colour.
2399+
/// A little stronger than the 5% `fg_overlay_1` used to apply, because that
2400+
/// colour is nearer the pill's own background than the contrasting one is.
2401+
const PIN_BUTTON_HOVER_OPACITY: u8 = 8;
2402+
23942403
/// Cutout-ring diameter of the status badge, per design.
23952404
const PILL_BADGE_RING_SIZE: f32 = 11.;
23962405
/// Bounding box of the status icon inside that ring, per design. The 1px it

0 commit comments

Comments
 (0)