opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(tui): add appearance setting with dark/light/system modes

Open nguyenphutrong opened this issue 1 week ago • 1 comments

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 appearance field 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 appearance field

Usage

Via Config

{
  "appearance": "system"
}

Via TUI

  1. Press Ctrl+X T to open theme dialog
  2. Use ←/→ to switch between System/Light/Dark modes
  3. Use ↑/↓ to browse themes

Screenshots

Screenshot 2026-01-07 at 16 23 32@2x

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

nguyenphutrong avatar Jan 07 '26 09:01 nguyenphutrong