Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 59f127a

Browse files
authored
fix: allow for theme references (anomalyco#4450)
1 parent 3068e7d commit 59f127a

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

  • packages/opencode/src/cli/cmd/tui/context

packages/opencode/src/cli/cmd/tui/context/theme.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,16 @@ function resolveTheme(theme: ThemeJson, mode: "dark" | "light") {
132132
if (c instanceof RGBA) return c
133133
if (typeof c === "string") {
134134
if (c === "transparent" || c === "none") return RGBA.fromInts(0, 0, 0, 0)
135-
return c.startsWith("#") ? RGBA.fromHex(c) : resolveColor(defs[c])
135+
136+
if (c.startsWith("#")) return RGBA.fromHex(c)
137+
138+
if (defs[c]) {
139+
return resolveColor(defs[c])
140+
} else if (theme.theme[c as keyof Theme]) {
141+
return resolveColor(theme.theme[c as keyof Theme])
142+
} else {
143+
throw new Error(`Color reference "${c}" not found in defs or theme`)
144+
}
136145
}
137146
return resolveColor(c[mode])
138147
}

0 commit comments

Comments
 (0)