opencode / packages /tui /src /util /presentation.ts
SaylorTwift's picture
SaylorTwift HF Staff
Add files using upload-large-folder tool
0dbc9de verified
Raw
History Blame Contribute Delete
1.45 kB
const logo = {
left: [" ", "β–ˆβ–€β–€β–ˆ β–ˆβ–€β–€β–ˆ β–ˆβ–€β–€β–ˆ β–ˆβ–€β–€β–„", "β–ˆ__β–ˆ β–ˆ__β–ˆ β–ˆ^^^ β–ˆ__β–ˆ", "β–€β–€β–€β–€ β–ˆβ–€β–€β–€ β–€β–€β–€β–€ β–€~~β–€"],
right: [" β–„ ", "β–ˆβ–€β–€β–€ β–ˆβ–€β–€β–ˆ β–ˆβ–€β–€β–ˆ β–ˆβ–€β–€β–ˆ", "β–ˆ___ β–ˆ__β–ˆ β–ˆ__β–ˆ β–ˆ^^^", "β–€β–€β–€β–€ β–€β–€β–€β–€ β–€β–€β–€β–€ β–€β–€β–€β–€"],
}
const reset = "\x1b[0m"
const bold = "\x1b[1m"
const dim = "\x1b[90m"
function wordmark(pad = "") {
const draw = (line: string, fg: string, shadow: string, bg: string) =>
[...line]
.map((char) => {
if (char === "_") return `${bg} ${reset}`
if (char === "^") return `${fg}${bg}β–€${reset}`
if (char === "~") return `${shadow}β–€${reset}`
if (char === " ") return " "
return `${fg}${char}${reset}`
})
.join("")
return logo.left.map((line, index) => {
const left = draw(line, dim, "\x1b[38;5;235m", "\x1b[48;5;235m")
const right = draw(logo.right[index] ?? "", reset, "\x1b[38;5;238m", "\x1b[48;5;238m")
return `${pad}${left} ${right}`
})
}
export function sessionEpilogue(input: { title: string; sessionID?: string }) {
const weak = (text: string) => `${dim}${text.padEnd(10, " ")}${reset}`
return [
...wordmark(" "),
"",
` ${weak("Session")}${bold}${input.title}${reset}`,
` ${weak("Continue")}${bold}opencode -s ${input.sessionID}${reset}`,
"",
].join("\n")
}