Skip to content

Commit a6b6395

Browse files
authored
fix(tui): gate logo subpixel rendering on truecolor support (#25265)
1 parent 21f8027 commit a6b6395

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • packages/opencode/src/cli/cmd/tui/component

packages/opencode/src/cli/cmd/tui/component/logo.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { BoxRenderable, MouseButton, MouseEvent, RGBA, TextAttributes } from "@opentui/core"
2+
import { useRenderer } from "@opentui/solid"
23
import { For, createMemo, createSignal, onCleanup, onMount, type JSX } from "solid-js"
34
import { useTheme, tint } from "@tui/context/theme"
45
import * as Sound from "@tui/util/sound"
@@ -554,6 +555,7 @@ function buildIdleState(t: number, ctx: LogoContext): IdleState {
554555
export function Logo(props: { shape?: LogoShape; ink?: RGBA; idle?: boolean } = {}) {
555556
const ctx = props.shape ? build(props.shape) : DEFAULT
556557
const { theme } = useTheme()
558+
const renderer = useRenderer()
557559
const [rings, setRings] = createSignal<Ring[]>([])
558560
const [hold, setHold] = createSignal<Hold>()
559561
const [release, setRelease] = createSignal<Release>()
@@ -684,6 +686,7 @@ export function Logo(props: { shape?: LogoShape; ink?: RGBA; idle?: boolean } =
684686
})
685687

686688
const idleState = createMemo(() => (props.idle ? buildIdleState(frame().t, ctx) : undefined))
689+
const useSubpixelBlocks = () => renderer.capabilities?.rgb === true
687690

688691
const renderLine = (
689692
line: string,
@@ -789,7 +792,7 @@ export function Logo(props: { shape?: LogoShape; ink?: RGBA; idle?: boolean } =
789792
}
790793

791794
// Solid █: render as ▀ so the top pixel (fg) and bottom pixel (bg) can carry independent shimmer values
792-
if (char === "█") {
795+
if (char === "█" && useSubpixelBlocks()) {
793796
return (
794797
<text
795798
fg={shade(inkTop, theme, n + p + e + b)}

0 commit comments

Comments
 (0)