Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions packages/opencode/src/cli/ui.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { EOL } from "os"
import { Schema } from "effect"
import { banner } from "./logo"
import { ansiWordmark, wordmark } from "./logo"

// Fork: hub-style CODEV banner (see @opencode-ai/tui/logo).
const wordmark = banner
// Fork: lowercase "codev" wordmark (see @opencode-ai/tui/logo).

export class CancelledError extends Schema.TaggedErrorClass<CancelledError>()("UICancelledError", {}) {}

Expand Down Expand Up @@ -45,8 +44,8 @@ export function logo(pad?: string) {
if (!process.stdout.isTTY && !process.stderr.isTTY) {
return wordmark.map((row) => (pad ?? "") + row).join(EOL)
}
// Bold bright cyan, matching the codev hub CLI banner.
return wordmark.map((row) => (pad ?? "") + "\x1b[1m\x1b[96m" + row + "\x1b[0m").join(EOL)
// Bold codev brand teal with the drop shadow, matching the TUI home banner.
return ansiWordmark(pad).join(EOL)
}

export async function input(prompt: string): Promise<string> {
Expand Down
67 changes: 55 additions & 12 deletions packages/tui/src/component/logo.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,62 @@
import { RGBA, TextAttributes } from "@opentui/core"
import { For } from "solid-js"
import { banner } from "../logo"

// Fork: hub-style CODEV banner in uniform bold teal (Tailwind cyan-600),
// the codev brand color.
const BRAND = RGBA.fromHex("#0891b2")
import { TextAttributes } from "@opentui/core"
import { For, type JSX } from "solid-js"
import { tint, useTheme } from "../context/theme"
import { logo } from "../logo"

// Fork: lowercase "codev" wordmark (half the height of the block banner) in the
// theme's brand secondary (teal in dark, purple in light), with shadow marks.
export function Logo() {
const { theme } = useTheme()

const renderLine = (line: string, bold: boolean): JSX.Element[] => {
const brand = theme.secondary
const shadow = tint(theme.background, brand, 0.25)
const attrs = bold ? TextAttributes.BOLD : undefined
return Array.from(line).map((char) => {
if (char === "_") {
return (
<text fg={brand} bg={shadow} attributes={attrs} selectable={false}>
{" "}
</text>
)
}
if (char === "^") {
return (
<text fg={brand} bg={shadow} attributes={attrs} selectable={false}>
▀
</text>
)
}
if (char === "~") {
return (
<text fg={shadow} attributes={attrs} selectable={false}>
▀
</text>
)
}
if (char === ",") {
return (
<text fg={shadow} attributes={attrs} selectable={false}>
▄
</text>
)
}
return (
<text fg={brand} attributes={attrs} selectable={false}>
{char}
</text>
)
})
}

return (
<box>
<For each={banner}>
{(line) => (
<text fg={BRAND} attributes={TextAttributes.BOLD} selectable={false}>
{line}
</text>
<For each={logo.left}>
{(line, index) => (
<box flexDirection="row" gap={1}>
<box flexDirection="row">{renderLine(line, true)}</box>
<box flexDirection="row">{renderLine(logo.right[index()], true)}</box>
</box>
)}
</For>
</box>
Expand Down
39 changes: 29 additions & 10 deletions packages/tui/src/logo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,35 @@ export const logo = {
right: [" ▄ ", "█▀▀█ █▀▀█ █__█", "█__█ █^^^ █__█", "▀▀▀▀ ▀▀▀▀ ▀▀ "],
}

// Fork: hub-style CODEV banner (same ANSI-Shadow art as the codev hub's
// src/components/Banner.tsx). Used by the TUI home banner and CLI help.
export const banner = [
" ██████╗ ██████╗ ██████╗ ███████╗██╗ ██╗",
"██╔════╝██╔═══██╗██╔══██╗██╔════╝██║ ██║",
"██║ ██║ ██║██║ ██║█████╗ ██║ ██║",
"██║ ██║ ██║██║ ██║██╔══╝ ╚██╗ ██╔╝",
"╚██████╗╚██████╔╝██████╔╝███████╗ ╚████╔╝ ",
" ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═══╝ ",
]
// Fork: the lowercase "codev" wordmark composed into plain lines (shadow marks
// substituted to glyphs) for CLI banners that color each line uniformly.
const substituteMarks = (line: string) =>
Array.from(line, (char) =>
char === "_" ? " " : char === "^" || char === "~" ? "▀" : char === "," ? "▄" : char,
).join("")
export const wordmark = logo.left.map(
(line, index) => `${substituteMarks(line)} ${substituteMarks(logo.right[index] ?? "")}`,
)

// Fork: ANSI-colored lowercase wordmark for CLI banners, matching the TUI home
// banner: bold brand teal with a drop shadow behind the mark cells. The shadow
// is tint(theme dark background #0a0a0a, teal, 0.25) = #0a2c34.
export function ansiWordmark(pad = "") {
const reset = "\x1b[0m"
const teal = "\x1b[1m\x1b[38;2;8;145;178m"
const shadowFg = "\x1b[38;2;10;44;52m"
const shadowBg = "\x1b[48;2;10;44;52m"
const draw = (line: string) =>
Array.from(line, (char) => {
if (char === "_") return `${shadowBg} ${reset}`
if (char === "^") return `${teal}${shadowBg}▀${reset}`
if (char === "~") return `${shadowFg}▀${reset}`
if (char === ",") return `${shadowFg}▄${reset}`
if (char === " ") return " "
return `${teal}${char}${reset}`
}).join("")
return logo.left.map((line, index) => `${pad}${draw(line)} ${draw(logo.right[index] ?? "")}`)
}

export const go = {
left: [" ", "█▀▀▀", "█_^█", "▀▀▀▀"],
Expand Down
9 changes: 2 additions & 7 deletions packages/tui/src/util/presentation.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import { banner } from "../logo"
import { ansiWordmark } from "../logo"

const reset = "\x1b[0m"
const bold = "\x1b[1m"
const dim = "\x1b[90m"

function wordmark(pad = "") {
// Fork: hub-style CODEV banner in bold bright cyan.
return banner.map((line) => `${pad}${bold}\x1b[96m${line}${reset}`)
}

export function sessionEpilogue(input: { title: string; sessionID?: string }) {
const weak = (text: string) => `${dim}${text.padEnd(10, " ")}${reset}`
return [
...wordmark(" "),
...ansiWordmark(" "),
"",
` ${weak("Session")}${bold}${input.title}${reset}`,
` ${weak("Continue")}${bold}codev -s ${input.sessionID}${reset}`,
Expand Down
Loading