From 428c758f347755c812a028af48d777199484248c Mon Sep 17 00:00:00 2001 From: Ariane Emory Date: Wed, 4 Mar 2026 15:06:48 -0500 Subject: [PATCH] feat: add toolOutput theme property for distinct tool output color --- packages/opencode/src/cli/cmd/tui/context/theme.tsx | 13 +++++++++++-- .../src/cli/cmd/tui/routes/session/index.tsx | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/context/theme.tsx b/packages/opencode/src/cli/cmd/tui/context/theme.tsx index 2320c08ccc6..9c80eb9fb11 100644 --- a/packages/opencode/src/cli/cmd/tui/context/theme.tsx +++ b/packages/opencode/src/cli/cmd/tui/context/theme.tsx @@ -53,6 +53,7 @@ type ThemeColors = { info: RGBA text: RGBA textMuted: RGBA + toolOutput: RGBA selectedListItemText: RGBA background: RGBA backgroundPanel: RGBA @@ -131,9 +132,10 @@ type ColorValue = HexColor | RefName | Variant | RGBA type ThemeJson = { $schema?: string defs?: Record - theme: Omit, "selectedListItemText" | "backgroundMenu"> & { + theme: Omit, "selectedListItemText" | "backgroundMenu" | "toolOutput"> & { selectedListItemText?: ColorValue backgroundMenu?: ColorValue + toolOutput?: ColorValue thinkingOpacity?: number } } @@ -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)] }), @@ -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 diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx index f20267e0820..b047c27ec4c 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -1551,7 +1551,7 @@ function GenericTool(props: ToolProps) { onClick={overflow() ? () => setExpanded((prev) => !prev) : undefined} > - {limited()} + {limited()} {expanded() ? "Click to collapse" : "Click to expand"} @@ -1742,7 +1742,7 @@ function Bash(props: ToolProps) { $ {props.input.command} - {limited()} + {limited()} {expanded() ? "Click to collapse" : "Click to expand"}