Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions packages/opencode/src/cli/cmd/tui/context/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -700,12 +700,12 @@ function generateGrayScale(bg: RGBA, isDark: boolean): Record<number, RGBA> {

if (isDark) {
if (luminance < 10) {
grayValue = Math.floor(factor * 0.4 * 255)
grayValue = Math.floor(factor * 0.5 * 255)
newR = grayValue
newG = grayValue
newB = grayValue
} else {
const newLum = luminance + (255 - luminance) * factor * 0.4
const newLum = luminance + (255 - luminance) * factor * 0.5

const ratio = newLum / luminance
newR = Math.min(bgR * ratio, 255)
Expand All @@ -714,12 +714,12 @@ function generateGrayScale(bg: RGBA, isDark: boolean): Record<number, RGBA> {
}
} else {
if (luminance > 245) {
grayValue = Math.floor(255 - factor * 0.4 * 255)
grayValue = Math.floor(255 - factor * 0.5 * 255)
newR = grayValue
newG = grayValue
newB = grayValue
} else {
const newLum = luminance * (1 - factor * 0.4)
const newLum = luminance * (1 - factor * 0.5)

const ratio = newLum / luminance
newR = Math.max(bgR * ratio, 0)
Expand All @@ -746,19 +746,15 @@ function generateMutedTextColor(bg: RGBA, isDark: boolean): RGBA {

if (isDark) {
if (bgLum < 10) {
// Very dark/black background
grayValue = 180 // #b4b4b4
grayValue = 195
} else {
// Scale up for lighter dark backgrounds
grayValue = Math.min(Math.floor(160 + bgLum * 0.3), 200)
grayValue = Math.min(Math.floor(180 + bgLum * 0.3), 210)
}
} else {
if (bgLum > 245) {
// Very light/white background
grayValue = 75 // #4b4b4b
grayValue = 70
} else {
// Scale down for darker light backgrounds
grayValue = Math.max(Math.floor(100 - (255 - bgLum) * 0.2), 60)
grayValue = Math.max(Math.floor(90 - (255 - bgLum) * 0.2), 55)
}
}

Expand Down