Skip to content

Conversation

@RhysSullivan
Copy link
Contributor

@RhysSullivan RhysSullivan commented Jan 7, 2026

Another option other than polling is on focus if we want to do that instead, opus got this one to work but fair note it's AI generated and I'm not familiar enough with the render to know for accuracy atm - I can investigate this more deeply if needed

Screen.Recording.2026-01-06.at.8.23.46.PM.mov

==== AI Generated Below ===

Summary

  • Polls terminal background color every 5 seconds to detect system theme changes
  • Updates theme mode (dark/light) automatically when terminal colors change
  • Works for both system theme and named themes with dark/light variants (like opencode)

Changes

  • Added detectMode() helper to calculate dark/light from terminal background color
  • Added polling interval that re-queries terminal palette and updates mode when changed
  • Updated resolveSystemTheme() to detect and apply the correct mode

Testing

  1. Set theme to opencode (or any theme with dark/light variants)
  2. Change system/terminal theme from light to dark (or vice versa)
  3. Wait ~5 seconds - opencode should automatically switch to match

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

The following comment was made by an LLM, it may be inaccurate:

Based on my search, here are related PRs that may be relevant:

Potentially Related PRs:

  1. feat(theme): custom themes can use calculated system colors #6321 - feat(theme): custom themes can use calculated system colors

    • Related because it deals with system color handling and theme calculation
  2. feat: add theme hot-reload functionality #4879 - feat: add theme hot-reload functionality

    • Related because it involves dynamic theme updates, which is similar to the auto-detection and runtime switching in this PR

The current PR (#7162) is the only one specifically addressing runtime auto-detection of theme changes via terminal background color polling. The other PRs are tangentially related but address different aspects of theme management.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant