Skip to content

list: Draw accent-filled rows in accent_foreground - #3774

Merged
huacnlee merged 1 commit into
longbridge:mainfrom
AprilNEA:fix/accent-fill-rows-foreground
Nov 3, 2026
Merged

huacnlee merged 1 commit into
longbridge:mainfrom
AprilNEA:fix/accent-fill-rows-foreground

Conversation

@AprilNEA

@AprilNEA AprilNEA commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Description

The cursor and hover rows of searchable lists (Select, ComboBox, MultiComboBox) and a selected ListItem with list.active_highlight = false paint the theme's accent fill but keep foreground for their content. On a theme whose accent is a saturated color, that puts page text on the fill, below the contrast the theme pairs with it. PopupMenu rows, a checked Toggle, the calendar and the command palette already draw accent_foreground on accent.

This change uses accent_foreground on those three fills. The searchable list check mark now follows the row's text color instead of forcing foreground, so it stays legible on the cursor row; on a disabled row it dims with the label.

The default theme is unaffected, since its accent_foreground equals foreground. Among the bundled themes, Solarized Light and Alduin move from 4.2:1 and 5.3:1 to 10.2:1 on the cursor row. The hover row keeps its 70 % accent fill, so its contrast is lower than the cursor row's; the theme's pairing still applies there.

Screenshot

Story: Select › "Search and clear", dropdown open, ↓ once, pointer on a row.

Theme Before After
Blue Accent (a light demo theme: accent.background #2563eb, accent.foreground #ffffff) before after
Solarized Light (bundled) before after

Cursor row text on the accent fill, Blue Accent: 3.83:1 before → 5.17:1 after. Solarized Light: 4.23:1 → 10.23:1.

How to Test

  • cargo test -p gpui-component --test integration accent_fill — two new tests in crates/component/tests/integration/accent_fill_rows.rs. They apply a light theme with a blue accent and read the text color handed to a row's content: the searchable list cursor row and hovered row (real pointer move) must take accent_foreground, a plain row keeps foreground; a selected ListItem keeps foreground with the default list_active highlight and takes accent_foreground once list.active_highlight is off. Both fail on main.
  • cargo run -p gpui-component-story -- Select with a theme whose accent.foreground differs from foreground (for example Solarized Light from the theme picker): open a dropdown, move the cursor with ↓, hover a row.
  • cargo test -p gpui-component, cargo clippy -p gpui-component --all-targets -- -D warnings, cargo fmt --all -- --check, typos: clean on Linux.

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate.
  • Passed cargo run for story tests related to the changes.
  • Tested macOS, Windows and Linux platforms performance (if the change is platform-specific) — not platform-specific; verified on Linux.

The cursor and hover rows of searchable lists (Select, ComboBox,
MultiComboBox) and a selected ListItem without the active highlight paint
the theme's `accent` fill but kept `foreground` for their content. A theme
whose accent is a saturated color then puts page text on it, which can
fall below the contrast the theme pairs with that fill.

Use `accent_foreground` on those fills, as PopupMenu rows and a checked
Toggle already do. The searchable list check mark now follows the row's
text color instead of always using `foreground`.

@huacnlee huacnlee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally at 34dcb07: cargo fmt --check, cargo clippy -p gpui-component --all-targets -D warnings and cargo test -p gpui-component --test integration (52 passed, incl. the two new accent_fill_rows tests) are clean; CI is green.

The change is a pure theming fix with no public API: content on an accent fill now uses accent_foreground, matching PopupMenu, Toggle and the calendar. Default theme renders the same because accent_foreground == foreground there. Disabled rows still win in searchable_list/item.rs because the disabled text_color is applied after the selected one, and the check icon now inherits the row color, which is correct.

One small note: the hover row uses accent.opacity(0.7) with full accent_foreground. On a light theme with a saturated accent, white text on a 70% fill is a bit lower contrast than on the cursor row (the description mentions this). That is acceptable, but it is the trade-off the owner should be aware of.

Looks merge-ready from my side.

🤖 Noop (reviewer) · AI agent acting for @huacnlee

@huacnlee
huacnlee merged commit 0a81b34 into longbridge:main Nov 3, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants