fix(ui): keep theme text and selections readable (#6226)

* fix(ui): keep theme text and selections readable

* fix(tui): theme the blank composer cursor cell

* refactor(webui): centralize diff theme colors

* fix(tui): keep conversation selections readable

* fix(ui): preserve nested syntax colors and selection lifetimes
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-15 15:21:28 +08:00
1 parent 73c2441abc
commit c24153db86
32 files changed
+451 -165

No files matched your search

+12 -5
View File
@@ -16,6 +16,7 @@ import type { DiffViewerTheme } from "../views/diff-viewer"
import type { FooterHintTheme } from "../views/footer-hints"
import type { RecoveryNoticeTheme } from "../views/recovery-notice"
import type { UsagePanelTheme } from "../views/usage-panel"
import type { SelectionColors } from "../platform/selection"
export const IMAGE_PLACEHOLDER_STYLE = "image.placeholder"
export const SHIMMER_INTERVAL_MS = 80
@@ -38,13 +39,14 @@ export interface Palette {
userBackground: ColorInput
warm: ColorInput
cool: ColorInput
selection: SelectionColors
}
export const DARK: Palette = {
referenceBackground: "#0E0F11",
text: "#ECEDEE",
muted: "#A1A1AA",
faint: "#71717A",
faint: "#A1A1AA",
border: "#3F3F46",
accent: "#EF8E30",
link: "#60A5FA",
@@ -54,15 +56,16 @@ export const DARK: Palette = {
user: "#EF8E30",
// Codex-style turn anchor: 12% white over the reference dark background.
userBackground: "#2B2C2E",
warm: "#C26A25",
cool: "#1795A2",
warm: "#E9965A",
cool: "#36B8C7",
selection: { background: RGBA.fromHex("#3F3F46"), foreground: RGBA.fromHex("#ECEDEE") },
}
export const LIGHT: Palette = {
referenceBackground: "#FAFAFA",
text: "#18181B",
muted: "#6F6F78",
faint: "#8A8A94",
muted: "#62626B",
faint: "#62626B",
border: "#D4D4D8",
accent: "#B94D0B",
link: "#1D4ED8",
@@ -74,6 +77,7 @@ export const LIGHT: Palette = {
userBackground: "#F0F0F0",
warm: "#C2410C",
cool: "#0F766E",
selection: { background: RGBA.fromHex("#D4D4D8"), foreground: RGBA.fromHex("#18181B") },
}
// Until the terminal answers OSC 10/11, its default foreground is the only
@@ -93,6 +97,7 @@ export const TERMINAL: Palette = {
userBackground: RGBA.defaultBackground(),
warm: RGBA.defaultForeground(),
cool: RGBA.defaultForeground(),
selection: { background: RGBA.fromHex("#93C5FD"), foreground: RGBA.fromHex("#18181B") },
}
@@ -182,6 +187,8 @@ export function diffViewerTheme(palette: Palette, backgroundKnown: boolean): Dif
error: palette.error,
addedBackground: backgroundKnown ? light ? "#E7F6EC" : "#142D22" : null,
removedBackground: backgroundKnown ? light ? "#FCE8EA" : "#352024" : null,
selectionBackground: palette.selection.background,
selectionForeground: palette.selection.foreground,
syntax: syntaxStyle(palette),
}
}