Skip to content

Colorblind mode - #1257

Open
sferik wants to merge 3 commits into
mainfrom
colorblind-mode
Open

Colorblind mode#1257
sferik wants to merge 3 commits into
mainfrom
colorblind-mode

Conversation

@sferik

@sferik sferik commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

This PR adds a “Colorblind” button next to the “Dark” button in the toolbar. It swaps the covered/missed colors and the coverage bands from green/red to blue (covered) / orange (missed), the standard colorblind-safe pairing, in both the light and dark themes. Skipped stays yellow and the branch/method misses keep their orange and purple, since those already read as distinct hues. The choice persists in localStorage and is applied before first paint (no flash), mirroring the existing Dark toggle.

Screenshot 2026-08-09 at 10 29 45 AM Screenshot 2026-08-09 at 10 29 51 AM

Red and green are the report's core signal, covered versus missed, and
they are the pairing most colorblind viewers cannot tell apart. This
adds two independent ways to read coverage without relying on that
distinction.

A Colorblind toggle sits to the left of the Dark toggle in the toolbar.
It swaps the covered and missed colors, and the coverage bands, for
blue versus orange, the standard colorblind-safe pairing, in both the
light and dark themes. Skipped stays yellow and the branch and method
misses keep their orange and purple, since those already read as
distinct hues. The choice persists in localStorage and is applied
before first paint so there is no flash, mirroring the Dark toggle.

The source view now also carries a non-color marker in a left gutter on
every line: plus for covered, minus for missed, tilde for skipped, plus
or minus for a missed branch, and an f for an uncalled method. The same
glyphs appear on the legend swatches, so the mapping is legible in
greyscale and to assistive tech regardless of the palette. This is on
in every mode, not just colorblind, and was the maintainers' suggestion
on the issue.

Accessibility touch-ups alongside: both toggles report state with
aria-pressed, the dark toggle gains an aria-label, and a visible
focus-visible ring is drawn on keyboard-focused controls.

Resolves #534.
@sferik
sferik requested a balanced review from Copilot August 9, 2026 17:22

This comment was marked as resolved.

Two fixes from the PR review.

The dark toggle carried aria-pressed while its accessible name flipped
with state (Switch to dark mode / Switch to light mode). aria-pressed
needs a stable name to be meaningful, so drop it: the button is an
action button whose label names the action, and the label stays in
sync with the visible text (which also satisfies WCAG 2.5.3 Label in
Name, where a fixed name would not). The colorblind toggle, whose
label never changes, keeps aria-pressed.

The dark colorblind overrides outrank the print reset that forces a
light palette, so a report printed in dark plus colorblind mode kept
dark covered/missed backgrounds while the rest of the page went light.
Scope the dark colorblind values to screen so they never reach paper,
and re-assert the light colorblind values inside the print reset so a
colorblind report prints blue and orange rather than reverting to the
green and red its reader configured away.
@sferik
sferik requested a balanced review from Copilot August 9, 2026 17:50

This comment was marked as resolved.

The colorblind and dark toggles lived only in the report's toolbar,
which the source dialog covers while it is open, so a reader could not
switch modes without closing the file first. Add both toggles to the
dialog header as well.

The two copies are wired by a data-toggle attribute rather than an id,
and each kind shares one click handler with all its buttons synced, so
toggling from either place updates the palette and both buttons at
once. The dialog copies are hidden in print like the toolbar.
@sferik
sferik requested a balanced review from Copilot August 9, 2026 18:12

This comment was marked as low quality.

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.

2 participants