Support dark/light mode os sync #348

Open
opened 2026-02-16 17:26:22 -05:00 by yindo · 15 comments
Owner

Originally created by @stordahl on GitHub (Jun 27, 2025).

Originally assigned to: @kommander on GitHub.

Support for dark/light modes to sync with the os would be great

Originally created by @stordahl on GitHub (Jun 27, 2025). Originally assigned to: @kommander on GitHub. Support for dark/light modes to sync with the os would be great
yindo added the opentuidiscussion labels 2026-02-16 17:26:22 -05:00
Author
Owner

@adamdotdevin commented on GitHub (Jun 27, 2025):

it should already support this, can you share more about what you're seeing?

@adamdotdevin commented on GitHub (Jun 27, 2025): it should already support this, can you share more about what you're seeing?
Author
Owner

@stordahl commented on GitHub (Jun 27, 2025):

Just did some testing and it seems to be an issue in Wezterm where I only get dark mode for all themes

@stordahl commented on GitHub (Jun 27, 2025): Just did some testing and it seems to be an issue in Wezterm where I only get dark mode for all themes
Author
Owner

@ChristianPavilonis commented on GitHub (Aug 25, 2025):

Just did some testing and it seems to be an issue in Wezterm where I only get dark mode for all themes

Same using Zellij with kitty. (kitty outside of zellij works fine though)

@ChristianPavilonis commented on GitHub (Aug 25, 2025): > Just did some testing and it seems to be an issue in Wezterm where I only get dark mode for all themes Same using Zellij with kitty. (kitty outside of zellij works fine though)
Author
Owner

@treyhunner commented on GitHub (Sep 24, 2025):

I believe I am experiencing this same issue.

Running opencode within tmux in Gnome Terminal always shows dark mode, even though my system is always configured for light mode.

@treyhunner commented on GitHub (Sep 24, 2025): I believe I am experiencing this same issue. Running opencode within tmux in Gnome Terminal always shows dark mode, even though my system is always configured for light mode.
Author
Owner

@stordahl commented on GitHub (Sep 24, 2025):

@adamdotdevin I've recently moved to ghostty and, inside tmux, more of the UI seems to adapt when I change from dark mode to light mode, but the chat input and status bar don't update. Sometimes I even have to quit all opencode sessions, quit ghostty, and then the ui renders correctly

@stordahl commented on GitHub (Sep 24, 2025): @adamdotdevin I've recently moved to ghostty and, inside tmux, more of the UI seems to adapt when I change from dark mode to light mode, but the chat input and status bar don't update. Sometimes I even have to quit all opencode sessions, quit ghostty, and then the ui renders correctly
Author
Owner

@Artawower commented on GitHub (Oct 2, 2025):

The same problem occurs with zellij + wezterm; the system theme does not change the input fields:

Image
@Artawower commented on GitHub (Oct 2, 2025): The same problem occurs with zellij + wezterm; the system theme does not change the input fields: <img width="1370" height="786" alt="Image" src="https://github.com/user-attachments/assets/aa302357-6a5b-4d2a-879c-d377d58f2f38" />
Author
Owner

@erf commented on GitHub (Nov 16, 2025):

I'm using Ghostty on MacOS Thaoe and have it configured for both light and dark mode. If i change the OS theme from light to dark mode, the terminal will change theme as well. If i run opencode , it will show the same mode - however opencode won't detect OS theme changes when already running. Is it possible to listen for these changes?

Note: i haven't configured theme for opencode but relying on the Ghostty configuration

@erf commented on GitHub (Nov 16, 2025): I'm using Ghostty on MacOS Thaoe and have it configured for both light and dark mode. If i change the OS theme from light to dark mode, the terminal will change theme as well. If i run `opencode` , it will show the same mode - however `opencode` won't detect OS theme changes when already running. Is it possible to listen for these changes? Note: i haven't configured theme for opencode but relying on the Ghostty configuration
Author
Owner

@rekram1-node commented on GitHub (Nov 16, 2025):

I think @kommander would know best as to if it's possible and what may not be

@rekram1-node commented on GitHub (Nov 16, 2025): I think @kommander would know best as to if it's possible and what may not be
Author
Owner

@kommander commented on GitHub (Nov 16, 2025):

It is possible, with the caveat that not all terminals support it, but I'll support that event from opentui so opencode will be able to change the theme type automatically.

@kommander commented on GitHub (Nov 16, 2025): It is possible, with the caveat that not all terminals support it, but I'll support that event from opentui so opencode will be able to change the theme type automatically.
Author
Owner

@astrolox commented on GitHub (Nov 21, 2025):

I've started using the new opentui version of this.
I'm finding that I have to manually switch it to light mode each time I open it.
I'm also using a terminal and custom color scheme which most software is unable to detect as being either light or dark.

I investigated how to fix this in the past and found a solution using an environment variable called COLORFGBG (it's supported by a bunch of terminals and software). So in software I've written in the past I've included a fallback to reading this variable if the normal detection doesn't work. Would you be willing to include that feature in opencode please?

If not; is there some way to change the default from dark to light?

@astrolox commented on GitHub (Nov 21, 2025): I've started using the new opentui version of this. I'm finding that I have to manually switch it to light mode each time I open it. I'm also using a terminal and custom color scheme which most software is unable to detect as being either light or dark. I investigated how to fix this in the past and found a solution using an environment variable called COLORFGBG (it's supported by a bunch of terminals and software). So in software I've written in the past I've included a fallback to reading this variable if the normal detection doesn't work. Would you be willing to include that feature in opencode please? If not; is there some way to change the default from dark to light?
Author
Owner

@rekram1-node commented on GitHub (Nov 25, 2025):

@astrolox I fixed it so the light vs dark is persisted

@rekram1-node commented on GitHub (Nov 25, 2025): @astrolox I fixed it so the light vs dark is persisted
Author
Owner

@astrolox commented on GitHub (Nov 25, 2025):

Having it persisted is certainly an improvement. Thank you.

That said; sometimes I switch from light to dark depending on environment (day time office usage vs late night on call work). So improving the detection would be ideal as a future enhancement.

@astrolox commented on GitHub (Nov 25, 2025): Having it persisted is certainly an improvement. Thank you. That said; sometimes I switch from light to dark depending on environment (day time office usage vs late night on call work). So improving the detection would be ideal as a future enhancement.
Author
Owner

@stordahl commented on GitHub (Nov 25, 2025):

Having it persisted is certainly an improvement. Thank you.

That said; sometimes I switch from light to dark depending on environment (day time office usage vs late night on call work). So improving the detection would be ideal as a future enhancement.

This is my workflow as well so +1 on this callout

@stordahl commented on GitHub (Nov 25, 2025): > Having it persisted is certainly an improvement. Thank you. > > That said; sometimes I switch from light to dark depending on environment (day time office usage vs late night on call work). So improving the detection would be ideal as a future enhancement. This is my workflow as well so +1 on this callout
Author
Owner

@pvinis commented on GitHub (Dec 5, 2025):

ill also put a repro here.
i have iterm to swap colors on macos appearance change, so light mode has light grey background, and dark mode has black background.

so with that, when i have an iterm window open, and i toggle from light to dark mode, my iterm window changes its colors.

but if i do that while having opencode running, it never changes.

see here. claude, opencode and codex. claude is the only one handling things correctly.

dark mode
Image

flip to light mode
Image

@pvinis commented on GitHub (Dec 5, 2025): ill also put a repro here. i have iterm to swap colors on macos appearance change, so light mode has light grey background, and dark mode has black background. so with that, when i have an iterm window open, and i toggle from light to dark mode, my iterm window changes its colors. but if i do that while having opencode running, it never changes. see here. claude, opencode and codex. claude is the only one handling things correctly. dark mode <img width="895" height="1637" alt="Image" src="https://github.com/user-attachments/assets/dedf71fb-1229-465c-aff9-455ed8159bef" /> flip to light mode <img width="895" height="1637" alt="Image" src="https://github.com/user-attachments/assets/627d535c-d59f-4358-8ea4-3b4bc31baa80" />
Author
Owner

@smrdotgg commented on GitHub (Dec 20, 2025):

I think I've found the root cause!

TL;DR: If OpenCode isn't detecting your OS theme changes in tmux, try detaching and re-attaching to your tmux session (then restarting OpenCode if its still open)

After investigation, I've deduced that tmux captures the system theme in some variable on attachment. This is why on my setup (Macbook, Ghostty, Oh-my-tmux, Neovim, Opencode), I have to detach and re-attach to tmux, then restart OpenCode for it to actually get the proper theme.

The reason Neovim automatically switches is because for most people (including me) neovim is set up to check the actual system settings to see if its on dark mode.

But for OpenCode (and even other CLI's like git-delta), the theme data seems to rely on information that tmux captures and updates when the user creates a new session or attaches to an existing session.

I believe that is the key issue. You guys can test this theory. I have tested it rigorously and it has checked out consistently for me.

Let me know if this helps!!

@smrdotgg commented on GitHub (Dec 20, 2025): I think I've found the root cause! TL;DR: If OpenCode isn't detecting your OS theme changes in tmux, try detaching and re-attaching to your tmux session (then restarting OpenCode if its still open) After investigation, I've deduced that tmux captures the system theme in some variable on **attachment**. This is why on my setup (Macbook, Ghostty, Oh-my-tmux, Neovim, Opencode), I have to detach and re-attach to tmux, then restart OpenCode for it to actually get the proper theme. The reason Neovim automatically switches is because for most people (including me) neovim is set up to check the actual system settings to see if its on dark mode. But for OpenCode (and even other CLI's like `git-delta`), the theme data seems to rely on information that tmux captures and updates when the user creates a new session or attaches to an existing session. I believe that is the key issue. You guys can test this theory. I have tested it rigorously and it has checked out consistently for me. Let me know if this helps!!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#348