fix(tui): gate logo subpixel rendering on truecolor support (#25265)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { BoxRenderable, MouseButton, MouseEvent, RGBA, TextAttributes } from "@opentui/core"
|
import { BoxRenderable, MouseButton, MouseEvent, RGBA, TextAttributes } from "@opentui/core"
|
||||||
|
import { useRenderer } from "@opentui/solid"
|
||||||
import { For, createMemo, createSignal, onCleanup, onMount, type JSX } from "solid-js"
|
import { For, createMemo, createSignal, onCleanup, onMount, type JSX } from "solid-js"
|
||||||
import { useTheme, tint } from "@tui/context/theme"
|
import { useTheme, tint } from "@tui/context/theme"
|
||||||
import * as Sound from "@tui/util/sound"
|
import * as Sound from "@tui/util/sound"
|
||||||
@@ -554,6 +555,7 @@ function buildIdleState(t: number, ctx: LogoContext): IdleState {
|
|||||||
export function Logo(props: { shape?: LogoShape; ink?: RGBA; idle?: boolean } = {}) {
|
export function Logo(props: { shape?: LogoShape; ink?: RGBA; idle?: boolean } = {}) {
|
||||||
const ctx = props.shape ? build(props.shape) : DEFAULT
|
const ctx = props.shape ? build(props.shape) : DEFAULT
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
|
const renderer = useRenderer()
|
||||||
const [rings, setRings] = createSignal<Ring[]>([])
|
const [rings, setRings] = createSignal<Ring[]>([])
|
||||||
const [hold, setHold] = createSignal<Hold>()
|
const [hold, setHold] = createSignal<Hold>()
|
||||||
const [release, setRelease] = createSignal<Release>()
|
const [release, setRelease] = createSignal<Release>()
|
||||||
@@ -684,6 +686,7 @@ export function Logo(props: { shape?: LogoShape; ink?: RGBA; idle?: boolean } =
|
|||||||
})
|
})
|
||||||
|
|
||||||
const idleState = createMemo(() => (props.idle ? buildIdleState(frame().t, ctx) : undefined))
|
const idleState = createMemo(() => (props.idle ? buildIdleState(frame().t, ctx) : undefined))
|
||||||
|
const useSubpixelBlocks = () => renderer.capabilities?.rgb === true
|
||||||
|
|
||||||
const renderLine = (
|
const renderLine = (
|
||||||
line: string,
|
line: string,
|
||||||
@@ -789,7 +792,7 @@ export function Logo(props: { shape?: LogoShape; ink?: RGBA; idle?: boolean } =
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Solid █: render as ▀ so the top pixel (fg) and bottom pixel (bg) can carry independent shimmer values
|
// Solid █: render as ▀ so the top pixel (fg) and bottom pixel (bg) can carry independent shimmer values
|
||||||
if (char === "█") {
|
if (char === "█" && useSubpixelBlocks()) {
|
||||||
return (
|
return (
|
||||||
<text
|
<text
|
||||||
fg={shade(inkTop, theme, n + p + e + b)}
|
fg={shade(inkTop, theme, n + p + e + b)}
|
||||||
|
|||||||
Reference in New Issue
Block a user