Skip to content

fix: improve monochrome selection contrast - #123

Merged
kbuffardi merged 3 commits into
mainfrom
fix/issue-121-monochrome-selection-contrast
Oct 30, 2026
Merged

kbuffardi merged 3 commits into
mainfrom
fix/issue-121-monochrome-selection-contrast

Conversation

@kbuffardi

Copy link
Copy Markdown
Owner

Summary

  • Improve active and inactive selection contrast for monochrome-light and monochrome-dark.
  • Keep Monaco and xterm selection colors synchronized within each theme and state.
  • Add WCAG AA contrast assertions for configured selections and rendered Monaco/xterm smoke coverage.

Verification

  • npm run lint
  • npm run build
  • npm run test:e2e — 232 passing
  • node scripts/smoke-browser.mjs chrome — unable to complete in this environment; the harness hung during browser startup/runtime verification and was stopped.

The five existing non-monochrome themes were not changed.

Closes #121

Ensure active and inactive Monaco and xterm selections meet WCAG AA contrast in the monochrome themes, with runtime regression checks for both surfaces.
Monaco preserves token foregrounds inside selected text, so apply explicit monochrome selected-text colors and validate a real editor selection in the smoke hook.
@kbuffardi

Copy link
Copy Markdown
Owner Author

Implementation correction

@kbuffardi reported:

the current implementation is incorrect so the new tests must be wrong as well. In both monochrome themes, the background selection is the same color as the text so there is NO contrast.

Root cause: Monaco applied the configured selection background but retained the token foreground inside selected text. The previous smoke hook created a synthetic span, so it did not prove the actual Monaco selection rendering.

The PR now:

  • explicitly overrides Monaco .selected-text foregrounds for the two monochrome themes;
  • probes a real Monaco model selection in the smoke hook; and
  • retains WCAG AA checks for active/inactive Monaco and xterm selections.

Verification passed: lint, production build, and 234 E2E tests.

Use grayscale selection overlays that contrast with Monaco's unchanged source text, and inspect the real overlay and source span in the smoke hook.
@kbuffardi

Copy link
Copy Markdown
Owner Author

Monaco overlay correction

@kbuffardi reported:

active selected text has the same text color as background color; when another pane is focused on, then there is at least some contrast but I'm still not sure if it is proper contrast.

The active-state screenshots showed that Monaco draws selection backgrounds in an overlay separate from source-code text spans. The previous selected-text CSS targeted the overlay and could not change the glyph color.

The PR now removes that ineffective override and uses WCAG AA grayscale overlay backgrounds that contrast with Monaco's actual code foreground:

  • Monochrome Light: black on #999999 (active) and #bbbbbb (inactive).
  • Monochrome Dark: white on #555555 (active) and #707070 (inactive).

The smoke hook now reads the real selection overlay background and the rendered source span color independently. Lint, production build, and 234 E2E tests passed.

@kbuffardi
kbuffardi merged commit 1709d8d into main Oct 30, 2026
1 check passed
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.

feat: add monochrome visual themes

1 participant