feat(brand): render Neuron wordmark in TUI via kitty/iTerm2 graphics with ASCII fallback

This commit is contained in:
2026-08-21 15:55:55 -05:00
parent 8b26ac8e1b
commit 725802efa6
6 changed files with 65 additions and 25 deletions
+3 -3
View File
@@ -27,9 +27,9 @@
"zod": "catalog:"
},
"peerDependencies": {
"@opentui/core": ">=0.4.5",
"@opentui/keymap": ">=0.4.5",
"@opentui/solid": ">=0.4.5"
"@opentui/core": ">=0.5.6",
"@opentui/keymap": ">=0.5.6",
"@opentui/solid": ">=0.5.6"
},
"peerDependenciesMeta": {
"@opentui/core": {
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

+37 -1
View File
@@ -1,10 +1,32 @@
import { useRenderer } from "@opentui/solid"
import { createSignal, For, onMount, type JSX } from "solid-js"
import { RGBA, TextAttributes } from "@opentui/core"
import { For, type JSX } from "solid-js"
import { tint, useTheme } from "../context/theme"
import { logo } from "../logo"
import wordmark from "../assets/neuron-wordmark.png" with { type: "file" }
// The wordmark PNG renders through the Kitty graphics protocol (or iTerm2
// OSC 1337) when the terminal supports it; otherwise we fall back to the
// block-letter ASCII logo.
export function Logo() {
const { theme } = useTheme()
const renderer = useRenderer()
const [useImage, setImage] = createSignal(false)
const [imageFailed, setImageFailed] = createSignal(false)
onMount(() => {
// capability info lands asynchronously after startup; only trust an
// explicit positive detection
const caps = (renderer as { capabilities?: { kitty_graphics?: boolean; iterm2?: boolean } }).capabilities
if (caps?.kitty_graphics || caps?.iterm2) {
setImage(true)
return
}
const onCaps = (next: { kitty_graphics?: boolean; iterm2?: boolean }) => {
if (next?.kitty_graphics || next?.iterm2) setImage(true)
}
renderer.on("capabilities", onCaps)
})
const renderLine = (line: string, fg: RGBA, bold: boolean): JSX.Element[] => {
const shadow = tint(theme.background, fg, 0.25)
@@ -46,6 +68,20 @@ export function Logo() {
})
}
if (useImage() && !imageFailed()) {
return (
<box height={7}>
<image
source={wordmark}
width={34}
height={6}
fit="fit"
onError={() => setImageFailed(true)}
/>
</box>
)
}
return (
<box>
<For each={logo.left}>
+4
View File
@@ -0,0 +1,4 @@
declare module "*.png" {
const src: string
export default src
}