opencode icon indicating copy to clipboard operation
opencode copied to clipboard

System Theme no longer works after v1.0.0

Open malhashemi opened this issue 1 month ago • 3 comments

Description

System is no longer showing as a theme option, also configuring the theme to system in the app configuration does not work.

OpenCode version

v1.0.7

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

malhashemi avatar Nov 01 '25 11:11 malhashemi

Also getting this issue, seeing some crazy rapid development so expect this to be fixed soon!

paradise-runner avatar Nov 01 '25 15:11 paradise-runner

we're working on it this week

thdxr avatar Nov 01 '25 15:11 thdxr

Not sure if this is related, but after upgrading to 1.0, my custom theme I had defined no longer shows up in the selectable themes either. I don't see any errors like I used to if the theme wasn't available. So it seems like it knows about the file but can't use it. Did theming change with the upgrade?

https://github.com/ahokinson/dotfiles/blob/develop/common/opencode/themes/catppuccin-frappe.json

ahokinson avatar Nov 04 '25 23:11 ahokinson

Same problem with my custom theme not being available after update to 1.0.34

ssoteloserrano avatar Nov 06 '25 04:11 ssoteloserrano

Same here at version: 1.0.36

spacetime-labs avatar Nov 06 '25 22:11 spacetime-labs

custom themes aren't loaded yet - will get to it tomorrow

thdxr avatar Nov 06 '25 23:11 thdxr

SYSTEM THEME DONE

thdxr avatar Nov 06 '25 23:11 thdxr

Just upgraded .. am I doing something wrong. I can't see it show up in the list.

Image

cwegener avatar Nov 06 '25 23:11 cwegener

it's showing for me and working aside from background transparency

Image

seaweeduk avatar Nov 07 '25 00:11 seaweeduk

~~oh. I see. It's currently only available for 16-color terminals ...~~ ☹️

cwegener avatar Nov 07 '25 00:11 cwegener

Just upgraded .. am I doing something wrong. I can't see it show up in the list.

Ok. It's a problem when running inside a TMUX session ... I'll try to figure out what's going on there.

I do see it available in the list when outside of a TMUX session without problem.

I can set the theme to system when outside TMUX, but when I open a new opencode instance inside TMUX, I get the default opencode theme again.

EDIT:

Yeah. The 'system' theme implementation relies on being able to use OSC 4, so that it can copy those colors into a dynamically created theme called 'system'. I guess a proper 'TTY' theme would be needed instead.

However, currently I am not sure how a 'system' theme and 'TTY' theme would be different from a user's perspective (apart from not relying on OSC 4)

EDIT 2:

Going to have to figure out how to make my set up for TMUX to respond to OSC 4 .... https://github.com/tmux/tmux/issues/2567#issuecomment-778175690

cwegener avatar Nov 07 '25 00:11 cwegener

Hi, I can confirm that the system theme appears when I use 1.0.37 in kitty on NixOS but does not appear when I use the same version of opencode with kitty on NixOS and I am running tmux. I both of these cases, the command echo $COLORTERM outputs truecolor.

I also have my own custom theme in the ~/.config/opencode/themes directory and it does not appear when I run opencode in either the configuration with tmux or the one without it.

Let me know if you need more details, thanks for your awesome work on opencode as I use it regularly!

EDIT: Thanks for clarifying. I've tried several different approaches to getting opencode to work with OSC 4 passthrough on kitty and none seem to work correctly. It has been a long time since I setup my color in tmux! I am currently using version 3.5a of tmux with these (what I think are the main) relevant settings:

# Set the terminal to tmux-256color, supporting italics and bold
set -g default-terminal "tmux-256color"

# Enable true color support for better color highlighting
set -ga terminal-overrides ",*256col*:Tc"
set -ga terminal-overrides ",tmux-256color*:Tc"

set -as terminal-features ',*:osc4'
set -ga terminal-overrides ',*:XT'
set -as terminal-overrides 'xterm*:RGB'

So, @cwegener if you get anything to work, please let me know! Thanks!

gkapfham avatar Nov 07 '25 00:11 gkapfham

both of these cases, the command echo $COLORTERM outputs truecolor.

Nothing to do with the COLORTERM env var.

It's this new functionality here:

https://github.com/sst/opencode/blob/d1962ca5a7e65c50235e9c389772331e7cd7a0fe/packages/opencode/src/cli/cmd/tui/util/terminal.ts#L9

cwegener avatar Nov 07 '25 00:11 cwegener

set -as terminal-overrides 'xterm*:RGB'

So, @cwegener if you get anything to work, please let me know! Thanks!

That is the one setting I added to my tmux.conf and that makes tmux enable its RGB support. You can confirm it via tmux info | grep RGB both with and without that terminal-override.

But it doesn't actually make OSC 4 work for me inside TMUX ...

inside TMUX

Image

outside TMUX works fine

Image

EDIT

I'm going through the verbose tmux client and server logs comparing the logs with :RGB on and :RGB off .. have not really found anything interesting yet.

Might need to dive into the tmux source code to figure out what's going on there.

cwegener avatar Nov 07 '25 00:11 cwegener

After quickly scanning docs for zellij it looks like that terminal multiplexing tool has similar issues. I often (but not always) use opencode through nvim and the sidekick.nvim plugin that uses either tmux or zellij and it requires the use of the system theme to work correctly (at least right now). As such, not being able to use the system theme when opencode is run through tmux (and likely zellij) would create problems for certain people like me.

EDIT:

I forgot to mention that I also have set -g allow-passthrough on set and it does not seem to ensure that the OSC codes are passed through when running opencode. Although I've been using tmux for years, I'm not an expert with it and thus I may be overlooking something!

gkapfham avatar Nov 07 '25 01:11 gkapfham

I'm going through the verbose tmux client and server logs comparing the logs with :RGB on and :RGB off .. have not really found anything interesting yet.

Might need to dive into the tmux source code to figure out what's going on there.

For reference, this is where support for reading the colour palette via ? has been introduced:

https://github.com/tmux/tmux/commit/d721fb2a9fd70c157abb8540d4c50fca654f9f4d

cwegener avatar Nov 07 '25 02:11 cwegener

This is what what opencode found with Claude 4.5:

https://opencode.ai/s/0MczeZym

this is what's showing up in the tmux-server debug log when running with tmux -vv:

1762496932.732026 input_enter_osc
1762496932.732034 input_exit_osc: "4;3;?" (end ST)
1762496932.732042 bad OSC 4: 3;?

cwegener avatar Nov 07 '25 06:11 cwegener

I have same issue while running opencode inside nvim (left nvim in kitty, right kitty)

Image

It was working with v0.15.0

blaadje avatar Nov 07 '25 09:11 blaadje

Since the system theme still does not appear in version 1.0.48 when run in tmux but does appear otherwise, should we open a new issue to track the problem? As your schedule permits, please let us know how you would like to proceed @thdxr. Thanks, I appreciate your help!

gkapfham avatar Nov 09 '25 01:11 gkapfham

@gkapfham i believe there is an issue specifically with tmux on their end, a pr was merged in the tmux repo a week or so ago and we await their next release

but rn their last release was in 2024 :(

rekram1-node avatar Nov 09 '25 02:11 rekram1-node

Hi @rekram1-node, hey, thanks for this update, I appreciate it! If I am reading various issues for opencode, it seems like it is currently working better with zellij, is that right? So, one alternative I and others who use tmux might have is to switch to using zellij. If that is not the case and you have time, please let me know. When I have some free-time in my schedule I might try to look into converting my tmux and tmuxinator configurations to zellij, especially if zellij is more actively maintained and better supported by opencode.

gkapfham avatar Nov 09 '25 03:11 gkapfham

@gkapfham tbh im not sure I dont use either haha

but i think more opencode devs use tmux than zellij

rekram1-node avatar Nov 09 '25 04:11 rekram1-node

@gkapfham i believe there is an issue specifically with tmux on their end, a pr was merged in the tmux repo a week or so ago and we await their next release

Thanks for the update. https://github.com/tmux/tmux/commit/1e61e524003f7fa0f8e1b2b8c0a21cce000d3fa6 does indeed fix the issue with tmux. system theme works well in tmux when applying that patch to tmux.

cwegener avatar Nov 10 '25 21:11 cwegener

custom themes aren't loaded yet - will get to it tomorrow

Is there a place to track when this is implemented?

ahokinson avatar Nov 10 '25 21:11 ahokinson

Hi, I wanted to confirm that a recent version of opencode works correctly with the system theme when run in zellij and run in neovim with zellij. So, if you are currently using tmux and can figure out how to customize zellij to your liking, then this is a path forward with programs that are already released!

gkapfham avatar Nov 10 '25 22:11 gkapfham

This problem is still happening when using Tmux, system is not listed as an available Theme. (1.0.112 opencode version)

danmondra avatar Nov 25 '25 23:11 danmondra

This problem is still happening when using Tmux, system is not listed as an available Theme. (1.0.112 opencode version)

A tmux patch is required. Refer to my comment three entries above ...

https://github.com/sst/opencode/issues/3688#issuecomment-3513966167

cwegener avatar Nov 26 '25 07:11 cwegener

@danmondra we are waiting for the next tmux release and it will be fixed. The fix was already merged in but they didn't release it yet

rekram1-node avatar Nov 26 '25 07:11 rekram1-node

Can confirm it's working with tmux 3.6 from homebrew 🚀

Image

When you change from dark/bright mode you still need to detach/attach to tmux session and restart opencode, but that's minor inconvenience.

offlinehacker avatar Nov 28 '25 07:11 offlinehacker

For me it worked with tmux 3.6 on the 1.0.119 and then with the 1.0.120, the system theme disappeared again (I tried all versions from 1.0.122 to 1.0.119, system theme is only available in 1.0.119 on tmux 3.6). Between both, OpenTUI has been upgraded from 0.1.50 to 0.1.51 and contains https://github.com/sst/opentui/pull/354 which seem to be the cause (I did not had time to try reverting the commit to confirm).

noirbizarre avatar Nov 30 '25 13:11 noirbizarre