fix(cli): restore brand integrity of CLI wordmark (#10912)
This commit is contained in:
@@ -1,16 +1,13 @@
|
|||||||
import { TextAttributes, RGBA } from "@opentui/core"
|
import { TextAttributes, RGBA } from "@opentui/core"
|
||||||
import { For, type JSX } from "solid-js"
|
import { For, type JSX } from "solid-js"
|
||||||
import { useTheme, tint } from "@tui/context/theme"
|
import { useTheme, tint } from "@tui/context/theme"
|
||||||
|
import { logo, marks } from "@/cli/logo"
|
||||||
|
|
||||||
// Shadow markers (rendered chars in parens):
|
// Shadow markers (rendered chars in parens):
|
||||||
// _ = full shadow cell (space with bg=shadow)
|
// _ = full shadow cell (space with bg=shadow)
|
||||||
// ^ = letter top, shadow bottom (▀ with fg=letter, bg=shadow)
|
// ^ = letter top, shadow bottom (▀ with fg=letter, bg=shadow)
|
||||||
// ~ = shadow top only (▀ with fg=shadow)
|
// ~ = shadow top only (▀ with fg=shadow)
|
||||||
const SHADOW_MARKER = /[_^~]/
|
const SHADOW_MARKER = new RegExp(`[${marks}]`)
|
||||||
|
|
||||||
const LOGO_LEFT = [` `, `█▀▀█ █▀▀█ █▀▀█ █▀▀▄`, `█__█ █__█ █^^^ █__█`, `▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀~~▀`]
|
|
||||||
|
|
||||||
const LOGO_RIGHT = [` ▄ `, `█▀▀▀ █▀▀█ █▀▀█ █▀▀█`, `█___ █__█ █__█ █^^^`, `▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀`]
|
|
||||||
|
|
||||||
export function Logo() {
|
export function Logo() {
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
@@ -75,11 +72,11 @@ export function Logo() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<box>
|
<box>
|
||||||
<For each={LOGO_LEFT}>
|
<For each={logo.left}>
|
||||||
{(line, index) => (
|
{(line, index) => (
|
||||||
<box flexDirection="row" gap={1}>
|
<box flexDirection="row" gap={1}>
|
||||||
<box flexDirection="row">{renderLine(line, theme.textMuted, false)}</box>
|
<box flexDirection="row">{renderLine(line, theme.textMuted, false)}</box>
|
||||||
<box flexDirection="row">{renderLine(LOGO_RIGHT[index()], theme.text, true)}</box>
|
<box flexDirection="row">{renderLine(logo.right[index()], theme.text, true)}</box>
|
||||||
</box>
|
</box>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
|
|||||||
6
packages/opencode/src/cli/logo.ts
Normal file
6
packages/opencode/src/cli/logo.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export const logo = {
|
||||||
|
left: [" ", "█▀▀█ █▀▀█ █▀▀█ █▀▀▄", "█__█ █__█ █^^^ █__█", "▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀~~▀"],
|
||||||
|
right: [" ▄ ", "█▀▀▀ █▀▀█ █▀▀█ █▀▀█", "█___ █__█ █__█ █^^^", "▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀"],
|
||||||
|
}
|
||||||
|
|
||||||
|
export const marks = "_^~"
|
||||||
@@ -1,15 +1,9 @@
|
|||||||
import z from "zod"
|
import z from "zod"
|
||||||
import { EOL } from "os"
|
import { EOL } from "os"
|
||||||
import { NamedError } from "@opencode-ai/util/error"
|
import { NamedError } from "@opencode-ai/util/error"
|
||||||
|
import { logo as glyphs } from "./logo"
|
||||||
|
|
||||||
export namespace UI {
|
export namespace UI {
|
||||||
const LOGO = [
|
|
||||||
[` `, ` ▄ `],
|
|
||||||
[`█▀▀█ █▀▀█ █▀▀█ █▀▀▄ `, `█▀▀▀ █▀▀█ █▀▀█ █▀▀█`],
|
|
||||||
[`█░░█ █░░█ █▀▀▀ █░░█ `, `█░░░ █░░█ █░░█ █▀▀▀`],
|
|
||||||
[`▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ `, `▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀`],
|
|
||||||
]
|
|
||||||
|
|
||||||
export const CancelledError = NamedError.create("UICancelledError", z.void())
|
export const CancelledError = NamedError.create("UICancelledError", z.void())
|
||||||
|
|
||||||
export const Style = {
|
export const Style = {
|
||||||
@@ -47,15 +41,50 @@ export namespace UI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function logo(pad?: string) {
|
export function logo(pad?: string) {
|
||||||
const result = []
|
const result: string[] = []
|
||||||
for (const row of LOGO) {
|
const reset = "\x1b[0m"
|
||||||
if (pad) result.push(pad)
|
const left = {
|
||||||
result.push(Bun.color("gray", "ansi"))
|
fg: Bun.color("gray", "ansi") ?? "",
|
||||||
result.push(row[0])
|
shadow: "\x1b[38;5;235m",
|
||||||
result.push("\x1b[0m")
|
bg: "\x1b[48;5;235m",
|
||||||
result.push(row[1])
|
|
||||||
result.push(EOL)
|
|
||||||
}
|
}
|
||||||
|
const right = {
|
||||||
|
fg: reset,
|
||||||
|
shadow: "\x1b[38;5;238m",
|
||||||
|
bg: "\x1b[48;5;238m",
|
||||||
|
}
|
||||||
|
const gap = " "
|
||||||
|
const draw = (line: string, fg: string, shadow: string, bg: string) => {
|
||||||
|
const parts: string[] = []
|
||||||
|
for (const char of line) {
|
||||||
|
if (char === "_") {
|
||||||
|
parts.push(bg, " ", reset)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (char === "^") {
|
||||||
|
parts.push(fg, bg, "▀", reset)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (char === "~") {
|
||||||
|
parts.push(shadow, "▀", reset)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (char === " ") {
|
||||||
|
parts.push(" ")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
parts.push(fg, char, reset)
|
||||||
|
}
|
||||||
|
return parts.join("")
|
||||||
|
}
|
||||||
|
glyphs.left.forEach((row, index) => {
|
||||||
|
if (pad) result.push(pad)
|
||||||
|
result.push(draw(row, left.fg, left.shadow, left.bg))
|
||||||
|
result.push(gap)
|
||||||
|
const other = glyphs.right[index] ?? ""
|
||||||
|
result.push(draw(other, right.fg, right.shadow, right.bg))
|
||||||
|
result.push(EOL)
|
||||||
|
})
|
||||||
return result.join("").trimEnd()
|
return result.join("").trimEnd()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user