opencode
opencode copied to clipboard
feat(tui): add appearance setting with dark/light/system modes
Summary
Adds an appearance config option to control the TUI color scheme with three modes:
- dark: Always use dark variant of theme
- light: Always use light variant of theme
- system: Auto-detect from terminal background color (polls every 5s)
Changes
- Added
appearancefield to config schema (dark|light|system) - Added appearance selector UI in theme dialog with ←/→ keyboard navigation
- Implemented theme mode detection (analyzes theme JSON to determine dark-only/light-only/both support)
- Auto-disables unsupported modes for single-mode themes (e.g., aura, catppuccin-macchiato are dark-only)
- Real-time terminal background detection using
renderer.getPalette()for cross-platform support - Regenerated SDK types to include
appearancefield
Usage
Via Config
{
"appearance": "system"
}
Via TUI
- Press
Ctrl+X Tto open theme dialog - Use
←/→to switch between System/Light/Dark modes - Use
↑/↓to browse themes
Screenshots
The appearance selector appears at the top of the theme dialog. Unsupported modes are dimmed and cannot be selected.
Testing
- Tested with dark-only themes (aura, ayu, catppuccin-macchiato, nightowl)
- Tested with dual-mode themes (flexoki, github, opencode, tokyonight)
- Verified real-time system mode polling works across terminal theme changes