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

Function logo

packages/opencode/src/cli/ui.ts:48–104  ·  view source on GitHub ↗
(pad?: string)

Source from the content-addressed store, hash-verified

46}
47
48export function logo(pad?: string) {
49 if (!process.stdout.isTTY && !process.stderr.isTTY) {
50 const result = []
51 for (const row of wordmark) {
52 if (pad) result.push(pad)
53 result.push(row)
54 result.push(EOL)
55 }
56 return result.join("").trimEnd()
57 }
58
59 const result: string[] = []
60 const reset = "\x1b[0m"
61 const left = {
62 fg: "\x1b[90m",
63 shadow: "\x1b[38;5;235m",
64 bg: "\x1b[48;5;235m",
65 }
66 const right = {
67 fg: reset,
68 shadow: "\x1b[38;5;238m",
69 bg: "\x1b[48;5;238m",
70 }
71 const gap = " "
72 const draw = (line: string, fg: string, shadow: string, bg: string) => {
73 const parts: string[] = []
74 for (const char of line) {
75 if (char === "_") {
76 parts.push(bg, " ", reset)
77 continue
78 }
79 if (char === "^") {
80 parts.push(fg, bg, "▀", reset)
81 continue
82 }
83 if (char === "~") {
84 parts.push(shadow, "▀", reset)
85 continue
86 }
87 if (char === " ") {
88 parts.push(" ")
89 continue
90 }
91 parts.push(fg, char, reset)
92 }
93 return parts.join("")
94 }
95 glyphs.left.forEach((row, index) => {
96 if (pad) result.push(pad)
97 result.push(draw(row, left.fg, left.shadow, left.bg))
98 result.push(gap)
99 const other = glyphs.right[index] ?? ""
100 result.push(draw(other, right.fg, right.shadow, right.bg))
101 result.push(EOL)
102 })
103 return result.join("").trimEnd()
104}
105

Callers

nothing calls this directly

Calls 2

pushMethod · 0.80
drawFunction · 0.70

Tested by

no test coverage detected