Skip to content

fix(web): enforce AA contrast for extended terminal colors - #1

Open
lemkyz wants to merge 1 commit into
dchaudhari7177:feat/light-themefrom
lemkyz:fix/light-terminal-contrast
Open

fix(web): enforce AA contrast for extended terminal colors#1
lemkyz wants to merge 1 commit into
dchaudhari7177:feat/light-themefrom
lemkyz:fix/light-terminal-contrast

Conversation

@lemkyz

@lemkyz lemkyz commented Jul 26, 2026

Copy link
Copy Markdown

This is a focused follow-up to burakgon#89.

Why

The light palette covers ANSI colors 0–15, but the captured Claude terminal frame also uses xterm 256-color indexes 153, 246, 244, and 211. Against the paper terminal background, those colors measure approximately 1.39:1, 2.81:1, 3.65:1, and 2.08:1. Arbitrary truecolor output can bypass the 16-color palette in the same way.

What changed

  • Add an optional minimumContrast value to GhosttyTerminalTheme.
  • Enforce it in the canvas renderer against each cell’s actual foreground and background after inverse and selection handling.
  • Account for faint text after alpha compositing.
  • Parse both hex theme colors and the rgb() / rgba() strings emitted by the Ghostty runtime.
  • Enable WCAG AA 4.5:1 enforcement only for light mode; dark and OLED retain their existing rendering.
  • Keep live theme switching through the existing setTheme / rc-theme-change path.
  • Use the same black-or-white fallback behavior as native Ghostty minimum contrast.

Verification

  • 87/87 affected tests pass.
  • pnpm typecheck passes.
  • Scoped ESLint and git diff --check pass.
  • Verified in the real screenshot.html?scene=terminal canvas: previously unreadable indexed and faint colors become legible immediately in light mode.

This leaves the picker, storage, theme-color meta, tokens, and base light ANSI palette from burakgon#89 unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant