fix(app): agent fallback colors
This commit is contained in:
parent
1f9313847f
commit
743e83d9bf
2 changed files with 13 additions and 1 deletions
|
|
@ -57,6 +57,7 @@ import { Binary } from "@opencode-ai/util/binary"
|
||||||
import { retry } from "@opencode-ai/util/retry"
|
import { retry } from "@opencode-ai/util/retry"
|
||||||
import { playSound, soundSrc } from "@/utils/sound"
|
import { playSound, soundSrc } from "@/utils/sound"
|
||||||
import { Worktree as WorktreeState } from "@/utils/worktree"
|
import { Worktree as WorktreeState } from "@/utils/worktree"
|
||||||
|
import { agentColor } from "@/utils/agent"
|
||||||
|
|
||||||
import { useDialog } from "@opencode-ai/ui/context/dialog"
|
import { useDialog } from "@opencode-ai/ui/context/dialog"
|
||||||
import { useTheme, type ColorScheme } from "@opencode-ai/ui/theme"
|
import { useTheme, type ColorScheme } from "@opencode-ai/ui/theme"
|
||||||
|
|
@ -1639,7 +1640,7 @@ export default function Layout(props: ParentProps) {
|
||||||
if (!user?.agent) return undefined
|
if (!user?.agent) return undefined
|
||||||
|
|
||||||
const agent = sessionStore.agent.find((a) => a.name === user.agent)
|
const agent = sessionStore.agent.find((a) => a.name === user.agent)
|
||||||
return agent?.color
|
return agentColor(user.agent, agent?.color)
|
||||||
})
|
})
|
||||||
|
|
||||||
const hoverMessages = createMemo(() =>
|
const hoverMessages = createMemo(() =>
|
||||||
|
|
|
||||||
11
packages/app/src/utils/agent.ts
Normal file
11
packages/app/src/utils/agent.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
const defaults: Record<string, string> = {
|
||||||
|
ask: "var(--icon-agent-ask-base)",
|
||||||
|
build: "var(--icon-agent-build-base)",
|
||||||
|
docs: "var(--icon-agent-docs-base)",
|
||||||
|
plan: "var(--icon-agent-plan-base)",
|
||||||
|
}
|
||||||
|
|
||||||
|
export function agentColor(name: string, custom?: string) {
|
||||||
|
if (custom) return custom
|
||||||
|
return defaults[name] ?? defaults[name.toLowerCase()]
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue