fix(tui): preserve readability when terminal theme is unknown

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-29 11:28:53 +08:00
1 parent 4f7479ca64
commit cf25e91b17
14 files changed
+185 -101

No files matched your search

+7 -5
View File
@@ -4,16 +4,18 @@ import {
StyledText,
TextAttributes,
TextRenderable,
parseColor,
type CliRenderer,
type ColorInput,
type TextChunk,
} from "@opentui/core"
import { optionArrowUp } from "./platform-keys"
export interface QueuePreviewTheme {
accent: string
muted: string
faint: string
accent: ColorInput
muted: ColorInput
faint: ColorInput
}
const MAX_VISIBLE = 3
@@ -89,11 +91,11 @@ function oneLine(value: string): string {
return value.length > 240 ? `${preview}…` : preview
}
function chunk(text: string, color: string, bold = false): TextChunk {
function chunk(text: string, color: ColorInput, bold = false): TextChunk {
return {
__isChunk: true,
text,
fg: RGBA.fromHex(color),
fg: parseColor(color),
attributes: bold ? TextAttributes.BOLD : 0,
}
}