Skip to content

Commit 3ca83ed

Browse files
committed
fix: remove double normalization in terminal background detection
RGBA.fromInts() already normalizes r/g/b to 0.0-1.0 range, so dividing by 255 again in mode() made the luminance near-zero for any input. This caused getTerminalBackgroundColor() to always return "dark", breaking light variant selection for all dual-variant themes. Fixes anomalyco#22615 Related: anomalyco#20926
1 parent d7718d4 commit 3ca83ed

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎packages/opencode/src/cli/cmd/tui/util/terminal.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export namespace Terminal {
2020

2121
function mode(bg: RGBA | null): "dark" | "light" {
2222
if (!bg) return "dark"
23-
const luminance = (0.299 * bg.r + 0.587 * bg.g + 0.114 * bg.b) / 255
23+
const luminance = 0.299 * bg.r + 0.587 * bg.g + 0.114 * bg.b
2424
return luminance > 0.5 ? "light" : "dark"
2525
}
2626

0 commit comments

Comments
 (0)