Skip to content

fix(a11y): JSON syntax highlighting fails contrast ratio in dark mode#2

Open
uidaho-nsummers wants to merge 1 commit into
ui-insight:mainfrom
uidaho-nsummers:bug/1-syntax-highlighting
Open

fix(a11y): JSON syntax highlighting fails contrast ratio in dark mode#2
uidaho-nsummers wants to merge 1 commit into
ui-insight:mainfrom
uidaho-nsummers:bug/1-syntax-highlighting

Conversation

@uidaho-nsummers

Copy link
Copy Markdown

Fixes #1

Summary

  • Added .nt (Name.Tag — JSON property keys) to the blue names token group in the dark mode Pygments override
  • Added .kc (Keyword.Constant — JSON true/false/null) to the purple keywords token group in the dark mode Pygments override

The Pygments GitHub light theme was loaded from CDN and not overridden for these two token classes, causing ~1.8:1 contrast ratios in dark mode against the #1e1e2e background. Both token classes now resolve to Catppuccin Mocha palette colors that pass WCAG AA (4.5:1 minimum).

Changes

  • backend/app/dashboard/templates/blog/post.html — two selectors added to existing dark mode CSS block

Pre-existing quality issues (out of scope)

The main branch has the following quality issues that predate this change and are not introduced or worsened by this fix:

  • 2032 ruff linting errors across the Python codebase (uv run --extra dev ruff check backend/)
  • 3 failing unit tests on main: test_version_alignment, and 2× test_voice_api
  • 2 test collection errors: test_quota.py and test_scheduler.py fail to collect due to a missing DB URL in the test environment

These are noted here for transparency. Addressing them is recommended but outside the scope of this accessibility fix.

Adds missing Pygments token overrides for dark mode: .nt (JSON property
keys) and .kc (JSON true/false/null literals) were falling through to the
GitHub light theme colors (~1.8:1 contrast) against the #1e1e2e background.
Both now use Catppuccin Mocha colors matching the existing dark theme
(#89b4fa and #cba6f7), achieving 8:1 and 7.7:1 contrast ratios (WCAG AAA).

Fixes ui-insight#1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@uidaho-nsummers uidaho-nsummers marked this pull request as ready for review June 18, 2026 17:18
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.

fix(a11y): JSON syntax highlighting fails contrast ratio in dark mode

1 participant