From d951e94cb7e79f71a221c6caa4017cf15b1bc10b Mon Sep 17 00:00:00 2001 From: Bence Ferdinandy Date: Fri, 6 Nov 2026 03:03:37 +0100 Subject: [PATCH] fix(tui): honor configured agent colors in Mini (#62067) Co-authored-by: Daniel Smolsky --- packages/tui/src/mini/catalog.shared.ts | 1 + packages/tui/src/mini/footer.view.tsx | 10 +++++----- packages/tui/src/mini/types.ts | 1 + packages/tui/test/mini/footer.view.test.tsx | 16 ++++++++++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/packages/tui/src/mini/catalog.shared.ts b/packages/tui/src/mini/catalog.shared.ts index d825c9869c0..2d2619fc5ac 100644 --- a/packages/tui/src/mini/catalog.shared.ts +++ b/packages/tui/src/mini/catalog.shared.ts @@ -32,6 +32,7 @@ function runAgent(input: CurrentAgent): RunAgent { id: input.id, name: input.name, description: input.description, + color: input.color, mode: input.mode, hidden: input.hidden, } diff --git a/packages/tui/src/mini/footer.view.tsx b/packages/tui/src/mini/footer.view.tsx index e001868760d..21771043b20 100644 --- a/packages/tui/src/mini/footer.view.tsx +++ b/packages/tui/src/mini/footer.view.tsx @@ -9,7 +9,7 @@ // The view itself is stateless except for derived memos. /** @jsxImportSource @opentui/solid */ import { useRenderer, useTerminalDimensions } from "@opentui/solid" -import { TextBuffer, TextBufferView } from "@opentui/core" +import { RGBA, TextBuffer, TextBufferView } from "@opentui/core" import { For, Match, Show, Switch, createEffect, createMemo, createSignal, onCleanup } from "solid-js" import { OneCellSpinner } from "../component/one-cell-spinner" import { WORK_SPINNERS, SEED_LAUNCH, SEED_MONO } from "../ui/one-cell-motion" @@ -228,10 +228,10 @@ export function RunFooterView(props: RunFooterViewProps) { const theme = createMemo(() => runTheme().footer) const agentColor = createMemo(() => { const colors = theme().categorical - const index = props - .agents() - .filter((agent) => !agent.hidden) - .findIndex((agent) => agent.id === props.currentAgentID()) + const agents = props.agents().filter((agent) => !agent.hidden) + const index = agents.findIndex((agent) => agent.id === props.currentAgentID()) + const color = agents[index]?.color + if (!props.mono && color) return RGBA.fromHex(color) return colors[Math.max(0, index) % colors.length]! }) const block = createMemo(() => runTheme().block) diff --git a/packages/tui/src/mini/types.ts b/packages/tui/src/mini/types.ts index 45e0e20a9a2..f93e9e5579c 100644 --- a/packages/tui/src/mini/types.ts +++ b/packages/tui/src/mini/types.ts @@ -103,6 +103,7 @@ export type RunAgent = { id: string name: string description?: string + color?: string mode: "subagent" | "primary" | "all" hidden: boolean } diff --git a/packages/tui/test/mini/footer.view.test.tsx b/packages/tui/test/mini/footer.view.test.tsx index 3960fda1b13..6eb1381db41 100644 --- a/packages/tui/test/mini/footer.view.test.tsx +++ b/packages/tui/test/mini/footer.view.test.tsx @@ -2125,6 +2125,22 @@ test.each(["Build", "Plan"])("working marker matches the %s label and prompt rai } }) +test("configured agent color paints the label, prompt rail, and working marker", async () => { + const app = await renderFooter({ + agents: [{ id: "build", name: "Build", mode: "primary", hidden: false, color: "#ff79c6" }], + state: { phase: "running" }, + }) + try { + await app.renderOnce() + const spans = app.captureSpans().lines.flatMap((line) => line.spans) + for (const text of ["Build", "\u2503", "\u25aa"]) { + expect(spans.find((span) => span.text.includes(text))?.fg.toInts()).toEqual([255, 121, 198, 255]) + } + } finally { + app.cleanup() + } +}) + test("spinner repaints keep the prompt instance, cursor state, and footer height stable", async () => { const app = await renderFooter({ tuiConfig: createTuiResolvedConfig({ animations: true }),