Skip to content

Add a light theme that follows the terminal and OS, including live appearance changes - #8

Closed
moritzWa wants to merge 6 commits into
xhluca:mainfrom
moritzWa:light-theme
Closed

moritzWa wants to merge 6 commits into
xhluca:mainfrom
moritzWa:light-theme

Conversation

@moritzWa

@moritzWa moritzWa commented Sep 28, 2026 •

Copy link
Copy Markdown

Summary

  • The dashboard hard-coded a dark palette, so it stayed dark on light-mode machines and light terminals.
  • --theme auto (the default) follows the same signals as Claude Code, Codex, and Cursor Agent: the terminal background (OSC 11, then COLORFGBG), then the operating system appearance (macOS AppleInterfaceStyle, Windows AppsUseLightTheme, GNOME color-scheme). If none of those answer, it stays on the existing dark palette.
  • --theme light and --theme dark force a palette. The light palette keeps selected text dark so a highlighted row stays readable.
  • auto also follows the desktop while the dashboard runs: a background thread polls the OS appearance every 2 s and swaps palettes on change. Only real changes are reported, so a dark terminal on a light desktop keeps the terminal-derived palette until the user actually switches appearance. The terminal itself cannot be re-queried (OSC 11) once the event loop owns stdin, which is why this uses the OS signal.

There was no open issue for this.

Test plan

  • cargo test --locked --lib theme::
  • cargo test --locked --lib ui::
  • cargo test --locked --bin open-agent-view -- theme_defaults
  • On a light-mode Mac, a truecolor PTY shows the light background for --theme auto and --theme light, and the original dark background for --theme dark
  • With the dashboard running in a PTY, toggling macOS appearance via System Events switched the rendered background between 181a1b and ffffff within the 2 s poll, and back
  • Reviewer: run oav in a light terminal and a dark terminal, and confirm --theme light / --theme dark override both

Made with Cursor

Screenshots

Same fixture, same 110x30 terminal, real frames rendered from the binary's output.

--theme light (also what auto picks on a light-mode Mac)

Light theme

--theme dark (unchanged from today)

Dark theme

Live switch

Same oav --theme auto process, same fixture, no restart. The dashboard started on a light macOS appearance, then the appearance was switched to dark while it was running. The palette changed on the next poll.

Still running, macOS light

Auto theme on a light desktop

Same process after switching macOS to dark

Auto theme after switching to a dark desktop

Review follow-up

  • The OSC 11 query is followed by a device-attributes query, and the read waits for that reply (500 ms cap), so a slow reply over ssh/tmux can no longer leak into the composer as keystrokes. Only a complete, terminated OSC 11 reply is accepted, and pending input is flushed before the terminal is restored.
  • On Linux, gsettings is only consulted inside a desktop session (DISPLAY/WAYLAND_DISPLAY) and its in-memory fallback counts as unknown, so a headless ssh host stays dark.
  • Light palette text meets WCAG AA (4.5:1) on both the background and the selected row; a unit test enforces it.
  • The OS appearance poll stops after 5 failed lookups in a row.
  • CI lint fixed (too_many_arguments, a macOS-only helper that was dead on Linux).

Moritz Wallawitsch and others added 6 commits September 28, 2026 18:56
The dashboard always painted a dark background. Auto mode now uses the terminal background first, then the system appearance, with an explicit dark or light override.

Co-authored-by: Cursor <cursoragent@cursor.com>
The light background was a warm off-white that read as beige next to a
light editor. Switch the light palette to pure white with VS Code Light's
greys, blue accent, warning amber, and green.

Co-authored-by: Cursor <cursoragent@cursor.com>
--theme auto resolved once at startup, so switching the desktop between light
and dark left the palette stuck until restart. Poll the OS appearance every two
seconds on a background thread and swap palettes when it changes. Only real
changes are reported: the startup choice (which may come from the terminal
background rather than the OS) stands until the user actually switches.

Co-authored-by: Cursor <cursoragent@cursor.com>
scheme_from_apple_interface_style is only called on macOS, so gate it like
its Windows and GNOME siblings. run_dashboard now takes nine arguments; allow
clippy::too_many_arguments as managed_docker.rs already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
attention (3.1:1), complete (4.3:1) and dim (4.2:1 on the selected row)
fell below 4.5:1. Darken them and test every light foreground against both
the page and the selected-row background.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The OSC 11 query restored cooked mode after 100ms, so a slower reply over
ssh, tmux or mosh arrived later as keystrokes. Follow it with DA1, which
every terminal answers in order, read until that reply or a 500ms deadline,
and flush pending input before restoring the terminal. Only accept an OSC 11
reply that carries its BEL or ST terminator.

On Linux without WAYLAND_DISPLAY or DISPLAY, gsettings reads its in-memory
backend and prints the schema default, which mapped to light. Treat that as
unknown so the dashboard stays dark. The appearance watcher now stops after
5 consecutive failed lookups instead of spawning a process every 2 seconds
forever.

The real-TTY harness answers DA1 like a real terminal so its startup timing
assertions measure the dashboard, not the query deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@xhluca xhluca closed this Oct 1, 2026
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