summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam <[email protected]>2026-01-06 21:16:38 -0600
committerAdam <[email protected]>2026-01-06 21:18:17 -0600
commit488c3502a71a7aa767cc142182f182a2b0dc7d23 (patch)
treed4277a54eb5b3a20fc5026217244863ce0833430
parenta2f80f7c0db5dda58222b35859c1620841d406c6 (diff)
downloadopencode-488c3502a71a7aa767cc142182f182a2b0dc7d23.tar.gz
opencode-488c3502a71a7aa767cc142182f182a2b0dc7d23.zip
fix(app): terminal selection color contrast
-rw-r--r--packages/app/src/components/terminal.tsx9
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/app/src/components/terminal.tsx b/packages/app/src/components/terminal.tsx
index 8b25f740b..0faca0a23 100644
--- a/packages/app/src/components/terminal.tsx
+++ b/packages/app/src/components/terminal.tsx
@@ -3,7 +3,7 @@ import { ComponentProps, createEffect, createSignal, onCleanup, onMount, splitPr
import { useSDK } from "@/context/sdk"
import { SerializeAddon } from "@/addons/serialize"
import { LocalPTY } from "@/context/terminal"
-import { resolveThemeVariant, useTheme } from "@opencode-ai/ui/theme"
+import { resolveThemeVariant, useTheme, withAlpha, type HexColor } from "@opencode-ai/ui/theme"
export interface TerminalProps extends ComponentProps<"div"> {
pty: LocalPTY
@@ -16,6 +16,7 @@ type TerminalColors = {
background: string
foreground: string
cursor: string
+ selectionBackground: string
}
const DEFAULT_TERMINAL_COLORS: Record<"light" | "dark", TerminalColors> = {
@@ -23,11 +24,13 @@ const DEFAULT_TERMINAL_COLORS: Record<"light" | "dark", TerminalColors> = {
background: "#fcfcfc",
foreground: "#211e1e",
cursor: "#211e1e",
+ selectionBackground: withAlpha("#211e1e", 0.2),
},
dark: {
background: "#191515",
foreground: "#d4d4d4",
cursor: "#d4d4d4",
+ selectionBackground: withAlpha("#d4d4d4", 0.25),
},
}
@@ -55,10 +58,14 @@ export const Terminal = (props: TerminalProps) => {
const resolved = resolveThemeVariant(variant, mode === "dark")
const text = resolved["text-stronger"] ?? fallback.foreground
const background = resolved["background-stronger"] ?? fallback.background
+ const alpha = mode === "dark" ? 0.25 : 0.2
+ const base = text.startsWith("#") ? (text as HexColor) : (fallback.foreground as HexColor)
+ const selectionBackground = withAlpha(base, alpha)
return {
background,
foreground: text,
cursor: text,
+ selectionBackground,
}
}