MCPcopy Create free account
hub / github.com/anomalyco/opencode / entryLook

Function entryLook

packages/opencode/src/cli/cmd/run/scrollback.shared.ts:21–72  ·  view source on GitHub ↗
(commit: StreamCommit, theme: RunEntryTheme)

Source from the content-addressed store, hash-verified

19}
20
21export function entryLook(commit: StreamCommit, theme: RunEntryTheme): { fg: ColorInput; attrs?: number } {
22 if (commit.kind === "user") {
23 return {
24 fg: theme.user.body,
25 //attrs: TextAttributes.BOLD,
26 }
27 }
28
29 if (entryFailed(commit)) {
30 return {
31 fg: theme.error.body,
32 attrs: TextAttributes.BOLD,
33 }
34 }
35
36 if (commit.phase === "final") {
37 return {
38 fg: theme.system.body,
39 attrs: TextAttributes.DIM,
40 }
41 }
42
43 if (commit.kind === "tool" && commit.phase === "start") {
44 return {
45 fg: theme.tool.start ?? theme.tool.body,
46 }
47 }
48
49 if (commit.kind === "assistant") {
50 return { fg: theme.assistant.body }
51 }
52
53 if (commit.kind === "reasoning") {
54 return {
55 fg: theme.reasoning.body,
56 attrs: TextAttributes.DIM,
57 }
58 }
59
60 if (commit.kind === "error") {
61 return {
62 fg: theme.error.body,
63 attrs: TextAttributes.BOLD,
64 }
65 }
66
67 if (commit.kind === "tool") {
68 return { fg: theme.tool.body }
69 }
70
71 return { fg: theme.system.body }
72}
73
74export function entryColor(commit: StreamCommit, theme: RunTheme): ColorInput {
75 if (commit.kind === "assistant") {

Callers 4

RunEntryContentFunction · 0.90
setThemeMethod · 0.90
createEntryMethod · 0.90
entryColorFunction · 0.85

Calls 1

entryFailedFunction · 0.85

Tested by

no test coverage detected