Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions packages/opencode/src/cli/cmd/tui/context/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type ThemeColors = {
info: RGBA
text: RGBA
textMuted: RGBA
toolOutput: RGBA
selectedListItemText: RGBA
background: RGBA
backgroundPanel: RGBA
Expand Down Expand Up @@ -131,9 +132,10 @@ type ColorValue = HexColor | RefName | Variant | RGBA
type ThemeJson = {
$schema?: string
defs?: Record<string, HexColor | RefName>
theme: Omit<Record<keyof ThemeColors, ColorValue>, "selectedListItemText" | "backgroundMenu"> & {
theme: Omit<Record<keyof ThemeColors, ColorValue>, "selectedListItemText" | "backgroundMenu" | "toolOutput"> & {
selectedListItemText?: ColorValue
backgroundMenu?: ColorValue
toolOutput?: ColorValue
thinkingOpacity?: number
}
}
Expand Down Expand Up @@ -199,7 +201,7 @@ function resolveTheme(theme: ThemeJson, mode: "dark" | "light") {

const resolved = Object.fromEntries(
Object.entries(theme.theme)
.filter(([key]) => key !== "selectedListItemText" && key !== "backgroundMenu" && key !== "thinkingOpacity")
.filter(([key]) => key !== "selectedListItemText" && key !== "backgroundMenu" && key !== "thinkingOpacity" && key !== "toolOutput")
.map(([key, value]) => {
return [key, resolveColor(value as ColorValue)]
}),
Expand All @@ -222,6 +224,13 @@ function resolveTheme(theme: ThemeJson, mode: "dark" | "light") {
resolved.backgroundMenu = resolved.backgroundElement
}

// Handle toolOutput - optional with fallback to text
if (theme.theme.toolOutput !== undefined) {
resolved.toolOutput = resolveColor(theme.theme.toolOutput)
} else {
resolved.toolOutput = resolved.text
}

// Handle thinkingOpacity - optional with default of 0.6
const thinkingOpacity = theme.theme.thinkingOpacity ?? 0.6

Expand Down
4 changes: 2 additions & 2 deletions packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ function GenericTool(props: ToolProps<any>) {
onClick={overflow() ? () => setExpanded((prev) => !prev) : undefined}
>
<box gap={1}>
<text fg={theme.text}>{limited()}</text>
<text fg={theme.toolOutput}>{limited()}</text>
<Show when={overflow()}>
<text fg={theme.textMuted}>{expanded() ? "Click to collapse" : "Click to expand"}</text>
</Show>
Expand Down Expand Up @@ -1822,7 +1822,7 @@ function Bash(props: ToolProps<typeof BashTool>) {
<box gap={1}>
<text fg={theme.text}>$ {props.input.command}</text>
<Show when={output()}>
<text fg={theme.text}>{limited()}</text>
<text fg={theme.toolOutput}>{limited()}</text>
</Show>
<Show when={overflow()}>
<text fg={theme.textMuted}>{expanded() ? "Click to collapse" : "Click to expand"}</text>
Expand Down