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
no longer respects system theme (macos ghostty) #20926
If your issue is distinct from these (e.g. it previously worked and recently regressed specifically with Ghostty), please add that context to help distinguish it.
I'm experiencing this issue in both Windows & MacOS in default terminals.
While using "one-dark" opencode 1.4.7 using dark mode every time, opencode 1.4.0(i downgraded it) uses light mode in light dark mode in dark etc.
Shell env: COLORTERM=truecolor, TERM=xterm-256color, defaults read -g AppleInterfaceStyle returns Dark
All OpenCode themes render in their light variant (white background). The system theme is even worse: text becomes invisible.
Workarounds tried without success:
Force opencode theme via /theme
Create ~/.config/opencode/tui.json with "theme": "opencode"
Add window-theme = dark in Ghostty config
Launch with COLORFGBG="15;0" opencode
None of them change the behavior. Dark/light detection seems completely broken in this version with Ghostty + macOS Tahoe.
Reacted by Mikel Gascon, Cedric Sirianni and André Rouél
Same thing is happening to me in 1.14.19 same as GuillenSanti. I took a look and this probably has to do with PR #23188.
It looks like util/terminal.ts::getTerminalBackgroundColor was removed and replaced with renderer.waitForThemeMode(1000). I assume this was because the assumption was opentui already knows how to detect this, but it doesn't seem to be the case. This doesn't just affect Ghostty but Kitty and the default Terminal.app as well.
Here's a diff of the change that are probably causing the issue we're seeing. Take this with a grain of salt though, this isn't my forte.
diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx
--- a/packages/opencode/src/cli/cmd/tui/app.tsx
+++ b/packages/opencode/src/cli/cmd/tui/app.tsx
@@ -1,7 +1,6 @@
import { render, TimeToFirstDraw, useKeyboard, useRenderer, useTerminalDimensions } from "@opentui/solid"
import * as Clipboard from "@tui/util/clipboard"
import * as Selection from "@tui/util/selection"
-import * as Terminal from "@tui/util/terminal"
import { createCliRenderer, MouseButton, type CliRendererConfig } from "@opentui/core"
@@ -120,12 +119,6 @@ export function tui(input: {
const unguard = win32InstallCtrlCGuard()
win32DisableProcessedInput()
- const mode = await Terminal.getTerminalBackgroundColor()
-
- // Re-clear after getTerminalBackgroundColor() — setRawMode(false) restores
- // the original console mode which re-enables ENABLE_PROCESSED_INPUT.
- win32DisableProcessedInput()
-
const onExit = async () => {
unguard?.()
resolve()
@@ -136,6 +129,7 @@ export function tui(input: {
}
const renderer = await createCliRenderer(rendererConfig(input.config))
+ const mode = (await renderer.waitForThemeMode(1000)) ?? "dark"
looks like if you did this once, the theme is stuck on the setting until you do 'unlock theme mode'. maybe this is the case for some of you guys. otherwise i just tested this on macOS so no clue how it is on linux etc
if you are running in tmux, there might be a different issue. but running inside a native ghostty tab / split, this issue no longer occurs for me
The issue I described is also happening in a native Ghostty terminal, where the "system" theme is not picking up terminal colors properly. I don't know if that symptom is related to this issue, but it hasn't been fixed for me.
3. run `OPENCODE_VERSION=1.14.20 npx -y [email protected] run --cwd packages/opencode build --single` to build.
4. copy build binary using `cp $HOME/path/to/opencode/packages/opencode/dist/opencode-linux-x64/bin/opencode" "$HOME/.opencode/bin/opencode"`
5. run opencode as usual
Tested on Ubuntu 24.04, hyprland WM, terminal emulator: kitty and warp terminal.
Can confirm, this fixes the issue on kitty +/- tmux for me. Without it opencode loads for me always in dark mode.
Brightness detection was moved into OpenTUI in 1.14.24. opencode pins OpenTUI 0.1.99, which only supports CSI ?997 — this breaks on terminals that don't support the sequence (kitty 0.32.2, apt/noble ghostty, etc.).
Quick fix: clone repository, update opencode's OpenTUI dep to >=0.1.100, and rebuild. Will work as usual, with an adaptive theme.
Activity
github-actions commentedon Apr 3, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct from these (e.g. it previously worked and recently regressed specifically with Ghostty), please add that context to help distinguish it.
uloco commentedon Apr 3, 2026
This is not related to tmux or the opencode system theme
fix(tui): stop clobbering theme mode with auto-detected value on ever…
tienbg-zigexn commentedon Apr 11, 2026
I have the opposite problem, opencode keep using dark variant even though everything else on my machine using light variant (OSX + kitty)
fix: remove double normalization in terminal background detection
Haume0 commentedon Apr 17, 2026
I'm experiencing this issue in both Windows & MacOS in default terminals.
While using "one-dark" opencode 1.4.7 using dark mode every time, opencode 1.4.0(i downgraded it) uses light mode in light dark mode in dark etc.
So this is a new issue i hope its fixed.
Haume0 commentedon Apr 17, 2026
Version 1.4.8 also broke the "system" theme.
Haume0 commentedon Apr 17, 2026
in version 1.4.9 system theme fixed
bewa1t commentedon Apr 18, 2026
same on nvim
GuillenSanti commentedon Apr 20, 2026
Same issue here.
window-theme = dark,background = #000000)COLORTERM=truecolor,TERM=xterm-256color,defaults read -g AppleInterfaceStylereturnsDarkAll OpenCode themes render in their light variant (white background). The
systemtheme is even worse: text becomes invisible.Workarounds tried without success:
opencodetheme via/theme~/.config/opencode/tui.jsonwith"theme": "opencode"window-theme = darkin Ghostty configCOLORFGBG="15;0" opencodeNone of them change the behavior. Dark/light detection seems completely broken in this version with Ghostty + macOS Tahoe.
albestio commentedon Apr 20, 2026
I managed to turn it back to dark mode by manually switching theme, and later activating Dark Mode again.
WolffTech commentedon Apr 20, 2026
Same thing is happening to me in 1.14.19 same as GuillenSanti. I took a look and this probably has to do with PR #23188.
It looks like util/terminal.ts::getTerminalBackgroundColor was removed and replaced with renderer.waitForThemeMode(1000). I assume this was because the assumption was opentui already knows how to detect this, but it doesn't seem to be the case. This doesn't just affect Ghostty but Kitty and the default Terminal.app as well.
Here's a diff of the change that are probably causing the issue we're seeing. Take this with a grain of salt though, this isn't my forte.
diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx --- a/packages/opencode/src/cli/cmd/tui/app.tsx +++ b/packages/opencode/src/cli/cmd/tui/app.tsx @@ -1,7 +1,6 @@ import { render, TimeToFirstDraw, useKeyboard, useRenderer, useTerminalDimensions } from "@opentui/solid" import * as Clipboard from "@tui/util/clipboard" import * as Selection from "@tui/util/selection" -import * as Terminal from "@tui/util/terminal" import { createCliRenderer, MouseButton, type CliRendererConfig } from "@opentui/core" @@ -120,12 +119,6 @@ export function tui(input: { const unguard = win32InstallCtrlCGuard() win32DisableProcessedInput() - const mode = await Terminal.getTerminalBackgroundColor() - - // Re-clear after getTerminalBackgroundColor() — setRawMode(false) restores - // the original console mode which re-enables ENABLE_PROCESSED_INPUT. - win32DisableProcessedInput() - const onExit = async () => { unguard?.() resolve() @@ -136,6 +129,7 @@ export function tui(input: { } const renderer = await createCliRenderer(rendererConfig(input.config)) + const mode = (await renderer.waitForThemeMode(1000)) ?? "dark"10 remaining items
uloco commentedon Apr 21, 2026
if you are running in tmux, there might be a different issue. but running inside a native ghostty tab / split, this issue no longer occurs for me
uloco commentedon Apr 21, 2026
looks like if you did this once, the theme is stuck on the setting until you do 'unlock theme mode'. maybe this is the case for some of you guys. otherwise i just tested this on macOS so no clue how it is on linux etc
jwkicklighter commentedon Apr 21, 2026
The issue I described is also happening in a native Ghostty terminal, where the "system" theme is not picking up terminal colors properly. I don't know if that symptom is related to this issue, but it hasn't been fixed for me.
edit: I now see #23599
uloco commentedon Apr 22, 2026
on 1.14.20 it started happening again lol wtf...
Klassikcat commentedon Apr 23, 2026
@uloco I've addressed the cause on issue #23810
Quick fix:
packages/opencode/src/cli/cmd/tui/util/terminal.tsline22from:
to:
OPENCODE_VERSION=1.14.20 npx -y [email protected] run --cwd packages/opencode build --singleto build.cp $HOME/path/to/opencode/packages/opencode/dist/opencode-linux-x64/bin/opencode" "$HOME/.opencode/bin/opencode"Tested on Ubuntu 24.04, hyprland WM, terminal emulator: kitty and warp terminal.
karamanliev commentedon Apr 24, 2026
Can confirm, this fixes the issue on kitty +/- tmux for me. Without it opencode loads for me always in dark mode.
uloco commentedon Apr 24, 2026
NO way I'm doing this. switching manually for now :D
Haume0 commentedon Apr 24, 2026
I gave up, started using system
Klassikcat commentedon Apr 25, 2026
@Haume0
Brightness detection was moved into OpenTUI in
1.14.24. opencode pins OpenTUI0.1.99, which only supportsCSI ?997— this breaks on terminals that don't support the sequence (kitty0.32.2, apt/noble ghostty, etc.).Quick fix: clone repository, update opencode's OpenTUI dep to >=0.1.100, and rebuild. Will work as usual, with an adaptive theme.
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
uloco commentedon Jul 3, 2026
This is still an issue