[PR #9719] feat(tui): add system dark/light mode matching #13208

Open
opened 2026-02-16 18:18:04 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9719

State: open
Merged: No


Summary

Adds an option to automatically sync TUI theme mode with OS appearance.

Resolves #9697

Demo:

https://github.com/user-attachments/assets/9bb29f0c-e661-4fe0-a110-89cc4cf5f8a0

Changes

  • Add getOSDarkMode() function for cross-platform OS dark mode detection:
    • macOS: defaults read -g AppleInterfaceStyle
    • Windows: Registry query for AppsUseLightTheme
    • Linux: GNOME/KDE detection with terminal fallback
  • Add "Match system dark/light mode" toggle command in System category
  • Poll OS appearance every 3 seconds when enabled
  • Persist setting to kv.json as auto_mode_enabled (off by default)

Implementation Notes

  • Opt-in by default - feature is disabled until user explicitly enables it
  • Dynamic command title - shows "Stop matching..." when enabled
  • Works with any theme that has light/dark variants (e.g., github, catppuccin, rosepine)
  • The special system theme derives colors from terminal palette, so light/dark switching doesn't apply to it

Testing Checklist

  • macOS: Tested dark/light mode switching
  • Windows: Verify registry query works correctly
  • Linux (GNOME): Verify gsettings detection works
  • Linux (KDE): Verify kreadconfig5 detection works
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9719 **State:** open **Merged:** No --- ## Summary Adds an option to automatically sync TUI theme mode with OS appearance. Resolves #9697 **Demo:** https://github.com/user-attachments/assets/9bb29f0c-e661-4fe0-a110-89cc4cf5f8a0 ## Changes - Add `getOSDarkMode()` function for cross-platform OS dark mode detection: - **macOS**: `defaults read -g AppleInterfaceStyle` - **Windows**: Registry query for `AppsUseLightTheme` - **Linux**: GNOME/KDE detection with terminal fallback - Add "Match system dark/light mode" toggle command in System category - Poll OS appearance every 3 seconds when enabled - Persist setting to `kv.json` as `auto_mode_enabled` (off by default) ## Implementation Notes - **Opt-in by default** - feature is disabled until user explicitly enables it - **Dynamic command title** - shows "Stop matching..." when enabled - Works with any theme that has light/dark variants (e.g., `github`, `catppuccin`, `rosepine`) - The special `system` theme derives colors from terminal palette, so light/dark switching doesn't apply to it ## Testing Checklist - [x] macOS: Tested dark/light mode switching - [ ] Windows: Verify registry query works correctly - [ ] Linux (GNOME): Verify `gsettings` detection works - [ ] Linux (KDE): Verify `kreadconfig5` detection works
yindo added the pull-request label 2026-02-16 18:18:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13208