You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't use custom themes that use ANSI colors #4236
Trying to load a theme that uses ANSI colors causes opencode to error.
TypeError: undefined is not an object (evaluating 'c3[mode2]')
at resolveColor (src/cli/cmd/tui/context/theme.tsx:64:25)
at <anonymous> (src/cli/cmd/tui/context/theme.tsx:67:18)
at map (native:1:11)
at resolveTheme (src/cli/cmd/tui/context/theme.tsx:66:57)
at runComputation (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:742:22)
at updateComputation (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:724:3)
at readSignal (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:660:67)
at get (src/cli/cmd/tui/context/theme.tsx:106:18)
at <anonymous> (src/cli/cmd/tui/app.tsx:531:17)
at runComputation (../../node_modules/.bun/solid-js@1.9.9/node_modules/solid-js/dist/dev.js:742:22)...
OpenCode version
1.0.61
Steps to reproduce
Create a custom theme using the my-theme.json example
Change one of the color definitions to be a palette number, like "nord9": 9,.
Set the custom theme as the default in the opencode config
What are you trying to achieve? I may be supported at some point, but really can't tell when that would be. Maybe what you are trying to do can be done with what is available.
I want apps to react immediately to system appearance changes without me having to restart them.
I like apps to use my terminal palette so that I don't have to update a bunch of individual app themes if I ever change the palette.
I use a terminal theme named Selenized. One of its properties is that it swaps the white and black ends of the palette in light mode. If apps are configured properly, when my terminal switches from light to dark mode they'll handle the change transparently (they don't have to change themes or even be aware that anything happened).
I do use a truecolor theme in Neovim, but it's based on my terminal theme (at startup neovim dumps kitty's active colors and builds the theme from that), and it will dynamically react to system appearance changes.
Opencode's system theme does use the terminal palette (so it wouldn't be a huge extension to allow custom themes to do the same). However, the system theme makes some (reasonable) assumptions about the black and white palette slots that don't work well for me in light mode.
Yes, terminal palette is used and supported and we could expose that to the theme as well somehow. Automatic palette updates, if the terminal supports that, will be supported shortly as well.
Automatic palette updates, if the terminal supports that, will be supported shortly as well.
Automatic isn't really enough. I often have the same TUI app instance displayed in two different terminals via shared tmux sessions, which may or may not have the same colorscheme. If opencode used only a limited ansi color palette like base24 then it would render fine in all locations, even if one terminal is light mode and another dark mode (standards like base24 use inverse scales for gradients between light and dark mode so that they render correctly).
I would love to see true ANSI support. I added an implementation a few weeks ago, and it worked reasonably well, but there were a few places in the UI that relied on truecolor features to render properly.
Yes, terminal palette is used and supported and we could expose that to the theme as well somehow. Automatic palette updates, if the terminal supports that, will be supported shortly as well.
@kommander, this PR adds the feature system-like custom themes for referencing the generated "system" theme values within custom themes.
Activity
github-actions commentedon Nov 12, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
kommander commentedon Nov 12, 2025
This is not supported currently.
jason0x43 commentedon Nov 12, 2025
Drat. That was the reason I was excited about custom theme support being added back.
kommander commentedon Nov 12, 2025
What are you trying to achieve? I may be supported at some point, but really can't tell when that would be. Maybe what you are trying to do can be done with what is available.
jason0x43 commentedon Nov 12, 2025
I have two main goals:
I use a terminal theme named Selenized. One of its properties is that it swaps the white and black ends of the palette in light mode. If apps are configured properly, when my terminal switches from light to dark mode they'll handle the change transparently (they don't have to change themes or even be aware that anything happened).
I do use a truecolor theme in Neovim, but it's based on my terminal theme (at startup neovim dumps kitty's active colors and builds the theme from that), and it will dynamically react to system appearance changes.
jason0x43 commentedon Nov 12, 2025
Opencode's system theme does use the terminal palette (so it wouldn't be a huge extension to allow custom themes to do the same). However, the system theme makes some (reasonable) assumptions about the black and white palette slots that don't work well for me in light mode.
kommander commentedon Nov 12, 2025
Yes, terminal palette is used and supported and we could expose that to the theme as well somehow. Automatic palette updates, if the terminal supports that, will be supported shortly as well.
Nemo157 commentedon Jan 15, 2026
Automatic isn't really enough. I often have the same TUI app instance displayed in two different terminals via shared tmux sessions, which may or may not have the same colorscheme. If opencode used only a limited ansi color palette like base24 then it would render fine in all locations, even if one terminal is light mode and another dark mode (standards like
base24use inverse scales for gradients between light and dark mode so that they render correctly).jason0x43 commentedon Jan 15, 2026
I would love to see true ANSI support. I added an implementation a few weeks ago, and it worked reasonably well, but there were a few places in the UI that relied on truecolor features to render properly.
nihil2501 commentedon Jan 18, 2026
@kommander, this PR adds the feature
system-like custom themesfor referencing the generated "system" theme values within custom themes.{ "theme": { "background": "system", "foreground": "system", "primary": "#ff5500" } }github-actions commentedon Mar 27, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.