[FEATURE] Auto-detect terminal background to keep diffs readable
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When the system theme changes (light → dark or vice versa), terminals like Ghostty automatically follow. However, Claude Code keeps its previous theme, making diff highlights and syntax coloring unreadable — dark-on-dark or light-on-light. The only workaround is manually running /config every time.
Proposed Solution
Add a theme: "auto" option that queries the terminal's background color using the OSC 11 escape sequence (\e]11;?\a) and selects light/dark accordingly. This should run on startup and periodically or on resume to catch mid-session changes. Most modern terminals support OSC 11: Ghostty, iTerm2, Kitty, Alacritty, WezTerm, Windows Terminal.
Alternative Solutions
A hook-based approach where users wire up their own detection script, but this is complex for a common use case.
Priority
Medium
Feature Category
Configuration and settings
Use Case Example
I use Ghostty which follows macOS/Linux system appearance. When I switch to dark mode in the evening, Ghostty updates instantly but Claude Code's diffs become illegible until I notice and manually run /config.
Additional Context
OSC 11 is a well-established standard — no terminal-specific integration needed.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗