Skip to content

Fix unreadable agent toolbelt chip text after theme change#12970

Merged
kevinyang372 merged 3 commits into
masterfrom
factory/agent-toolbelt-chip-theme-refresh
Jun 24, 2026
Merged

Fix unreadable agent toolbelt chip text after theme change#12970
kevinyang372 merged 3 commits into
masterfrom
factory/agent-toolbelt-chip-theme-refresh

Conversation

@warp-dev-github-integration

@warp-dev-github-integration warp-dev-github-integration Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes context-chip text becoming unreadable after a theme switch (reported for the agent toolbelt in the Cyber Wave theme via Slack).

Root cause: Several surfaces cache context-chip renderers whose text color is derived from the theme at build time, and only rebuild on chip-selection changes. After switching themes the cached colors go stale — e.g. a color built under a light theme (near-black) stays on the chip when the user switches to a dark theme, rendering chip text dark-on-dark. (Action/control chips were unaffected because they recompute their color on every render.)

Fix: Refresh the chips' colors dynamically on theme change. Each affected editor/preview subscribes to AppearanceEvent::ThemeChanged and rebuilds its chips against the live appearance, preserving the current arrangement.

Surfaces fixed (after cross-checking all chip render sites):

  • Agent toolbelt editor (agent_input_footer/editor.rs) — the originally reported, highest-severity case (neutral text → dark-on-dark). New ChipConfigurator::refresh_appearance.
  • Terminal prompt editor (prompt/editor_modal.rs) — cached SingleZone chips; rebuilds used chips on theme change.
  • Settings → Appearance "Input" preview (settings_view/appearance_page.rs) — handle_appearance_update now handles ThemeChanged and rebuilds the preview chips.

Checked and not affected: the header toolbar editor (control items recompute color at render time) and the live terminal input / agent footer (already react to theme changes / render fresh).

Testing

  • Manually verified with computer_use (agent toolbelt editor, Light → Cyber Wave → Dark).
  • Deterministic contrast check on Cyber Wave: chip background #0c1e24; a color built under Light composites to #0f1619, contrast 1.07 (the bug); rebuilt under Cyber Wave it is #9ea5a7, contrast 6.84 (readable, matches the action chips, above WCAG AA 4.5).
  • cargo check/build pass; cargo clippy -p warp --tests -- -D warnings clean; existing context_chips::renderer tests pass.
  • Per the reporter's request, no new regression unit test was added.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Conversation: https://staging.warp.dev/conversation/8107a59b-3e05-40e9-894b-a43c4f41a938
Run: https://oz.staging.warp.dev/runs/019ef64c-af47-7971-b304-e6adcee9caa2

This PR was generated with Oz.

@cla-bot cla-bot Bot added the cla-signed label Jun 23, 2026
Context-chip colors are derived from the theme when a chip is built, and
the agent toolbelt editors cache their chip renderers (rebuilding only on
chip-selection changes). So after switching themes the cached colors went
stale — e.g. a color built under a light theme (near-black) stayed on the
chip when the user switched to a dark theme like Cyber Wave, rendering the
value chips dark-on-dark and unreadable. The neighboring action chips were
unaffected because they recompute their color on every render.

Refresh the chips' colors dynamically when the theme changes: the agent
toolbelt editors subscribe to `AppearanceEvent::ThemeChanged` and rebuild
the configurator's chips against the live appearance (preserving the
current arrangement, including unsaved edits), via the new
`ChipConfigurator::refresh_appearance`.

Co-Authored-By: Warp <agent@warp.dev>
@warp-dev-github-integration warp-dev-github-integration Bot force-pushed the factory/agent-toolbelt-chip-theme-refresh branch from 1b08549 to 0129823 Compare June 23, 2026 23:39
Cross-checking other places these context chips are rendered surfaced two
more spots with the same stale-color-on-theme-change root cause, both
caching theme-derived chip renderers without refreshing on a theme switch:

- The terminal prompt editor (`prompt/editor_modal.rs`) caches its
  `SingleZone` chip renderers and had no theme-change handling.
- The Settings > Appearance "Input" preview (`settings_view/appearance_page.rs`)
  cached `context_chips` and explicitly ignored `ThemeChanged`.

Both use prompt colors (vs the agent toolbelt's neutral text), so the
visible impact is usually milder, but switching from a light theme to a
dark one can still leave dark-on-dark chip text. Subscribe both to
`AppearanceEvent::ThemeChanged` and rebuild their chips against the live
appearance.

Not affected: the header toolbar editor (its items recompute their color
at render time) and the live terminal input/agent footer surfaces (which
already react to theme changes / render fresh).

Co-Authored-By: Warp <agent@warp.dev>
Comment thread app/src/chip_configurator/mod.rs Outdated
/// (agent toolbelt) is rebuilt this way; `SingleZone` chips are built from
/// pre-made renderers and are refreshed by their owner.
pub fn refresh_appearance(&mut self, appearance: &Appearance) {
if self.layout != ChipConfiguratorLayout::LeftRightZones {

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.

Why we are early returning for non LeftRightZones layout? This contract doesn't seem semantically correct given the method signature

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call — removed refresh_appearance entirely. As you noted, silently no-op'ing for SingleZone is an unclear contract for a method that reads like it refreshes any configurator. Instead, each agent toolbelt editor now rebuilds its chips via its own existing, layout-appropriate construction path on AppearanceEvent::ThemeChanged:

  • AgentToolbarInlineEditor reuses reset_from_settings (it persists its arrangement on every edit, so reloading preserves the user's layout) — matching the existing SessionSettings refresh right above it.
  • AgentToolbarEditorModal reuses open_toolbar_items_from_settings, guarded by has_items() so a closed modal isn't repopulated.

Net behavior is unchanged (chips rebuild against the live theme on a theme switch), but there's no longer a configurator method whose effect depends on a layout it doesn't take as a parameter. Fixed in 15a1a7d.

@kevinyang372 kevinyang372 marked this pull request as ready for review June 24, 2026 19:12
@oz-for-oss

oz-for-oss Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

@kevinyang372

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overview

This PR refreshes cached context-chip renderers on theme changes for the agent toolbelt editor, terminal prompt editor, and Appearance settings input preview so theme-derived chip text colors stay readable after switching themes.

Concerns

  • For this user-facing UI change, please include screenshots or a screen recording demonstrating the chip text remains readable after switching themes end to end. The provided PR description includes manual verification text but no attached visual evidence, which the Warp review guidance requires for UI-impacting changes.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

…gated helper

Replace ChipConfigurator::refresh_appearance — which silently no-op'd for
the SingleZone layout, an unclear contract for a method that reads like it
refreshes any configurator — with rebuilds via each editor's existing,
layout-appropriate construction path on AppearanceEvent::ThemeChanged:
- AgentToolbarInlineEditor reuses reset_from_settings (it persists its
  arrangement on every edit, so reloading preserves the user's layout),
  matching the existing SessionSettings refresh.
- AgentToolbarEditorModal reuses open_toolbar_items_from_settings, guarded
  by has_items() so a closed modal isn't repopulated.

Net behavior is unchanged (chips rebuild against the live theme on a theme
switch), but there's no longer a configurator method whose effect depends
on a layout it doesn't take as a parameter.

Co-Authored-By: Warp <agent@warp.dev>
@kevinyang372 kevinyang372 merged commit 0979019 into master Jun 24, 2026
27 checks passed
@kevinyang372 kevinyang372 deleted the factory/agent-toolbelt-chip-theme-refresh branch June 24, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants