mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 21:15:57 +03:00
fix(tui): honor configured agent colors in Mini (#62067)
Co-authored-by: Daniel Smolsky <dannysmo@gmail.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
a62a74a2af
commit
d951e94cb7
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -103,6 +103,7 @@ export type RunAgent = {
|
||||
id: string
|
||||
name: string
|
||||
description?: string
|
||||
color?: string
|
||||
mode: "subagent" | "primary" | "all"
|
||||
hidden: boolean
|
||||
}
|
||||
|
||||
@@ -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 }),
|
||||
|
||||
Reference in New Issue
Block a user