feat(tui): add system dark/light mode matching#9719
feat(tui): add system dark/light mode matching#9719justinlevinedotme wants to merge 2 commits intoanomalyco:devfrom
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR: Related PR:
This PR appears to be addressing similar functionality for TUI appearance/theme mode management. It may be implementing a related or overlapping feature for system dark/light mode support. You should review this PR to understand if it's a duplicate or if these PRs address different aspects of the same feature. |
9c480bf to
eb2a3f5
Compare
Add option to automatically sync TUI theme mode with OS appearance. Polls OS dark mode setting every 3 seconds when enabled. - Add getOSDarkMode() for cross-platform detection (macOS, Windows, Linux) - Add 'Match system dark/light mode' toggle in command list - Persist setting to kv.json as auto_mode_enabled (off by default) Closes anomalyco#9697
eb2a3f5 to
e50f77b
Compare
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
|
commenting on this because I would really like to see this feature too. there is however a new standardised way to get the terminal appearance. https://github.com/contour-terminal/contour/blob/master/docs/vt-extensions/color-palette-update-notifications.md#adoption-state |
|
I was searching for a performant and elegant way to solve this issue. Your solution #9719 works great! I would like to raise a question: I am not sure polling for the system theme every 3 seconds is really performant. Isn’t there a better way? Can’t we listen to the system preferences directly, like we do with media queries on the web? |
|
Looks like #7182 is trying to achieve the same feature with 2s polling longer |
|
polling is definitely not the preferred way to implement this. instead we should enable DSR (device status report) messages for color palette updates. the link I shared in my previous comment explains this. then we are subscribed to notifications for when the appearance changes and can act directly |
|
@disrupted did you try implementing this? |
|
I think it would require some sort of feedback on this topic from the maintainers before starting actual work on it. this repo is currently getting flooded by PRs without prior planning (most of these will never get merged). I would not want to invest effort into this before a green light |
100%, polling is used in other parts of app, so that's why I used it here. I also was trying to not add too much to the app, using existing systems where possible. |
Summary
Adds an option to automatically sync TUI theme mode with OS appearance.
Resolves #9697
Demo:
CleanShot.2026-01-20.at.15.03.26.mp4
Changes
getOSDarkMode()function for cross-platform OS dark mode detection:defaults read -g AppleInterfaceStyleAppsUseLightThemekv.jsonasauto_mode_enabled(off by default)Implementation Notes
github,catppuccin,rosepine)systemtheme derives colors from terminal palette, so light/dark switching doesn't apply to itTesting Checklist
gsettingsdetection workskreadconfig5detection works