Skip to content

fix(a11y): add dark-theme overrides for hardcoded light-theme colours#14839

Open
skjnldsv wants to merge 1 commit into
masterfrom
fix/a11y-dark-theme-color-overrides
Open

fix(a11y): add dark-theme overrides for hardcoded light-theme colours#14839
skjnldsv wants to merge 1 commit into
masterfrom
fix/a11y-dark-theme-color-overrides

Conversation

@skjnldsv
Copy link
Copy Markdown
Member

@skjnldsv skjnldsv commented May 13, 2026

☑️ Resolves

The recent BITV contrast fixes (#14827, #14828, #14829, #14830) hardcoded colours chosen for the white/light background. The sphinx-rtd-dark-mode plugin switches backgrounds to #141414 (content) and #2d2d2d (code), making those values fail WCAG AA in dark mode:

Element Colour Dark bg Contrast Issue
.rst-content a #2474a4 #141414 3.6:1 needs 4.5:1; also overrides plugin's --dark-link-color
code #c0392b !important #2d2d2d 2.4:1 !important defeats plugin's html[data-theme="dark"] rule
.wy-form-search-icon #555 #0b152d ~1.7:1 icon invisible

Adds html[data-theme="dark"] overrides scoped to dark mode only — no changes to existing light-theme rules:

  • Links → var(--dark-link-color, #249ee8) (~6.1:1 on #141414)
  • Inline code → #ff7878 (~4.9:1 on #2d2d2d)
  • Search icon → #aaa

🖼️ Screenshots

✅ Checklist

  • I have built the documentation locally and reviewed the output
  • Screenshots are included for visual changes
  • I have not moved or renamed pages (or added a redirect if I did)
  • I have run codespell or similar and addressed any spelling issues

The recent BITV contrast fixes hardcoded colours that were chosen for
the white (light) background. The sphinx-rtd-dark-mode plugin switches
the content background to ~#141414 and code bg to #2d2d2d, making
those values fail WCAG AA in dark mode:

- .rst-content a: #2474a4 → 3.6:1 on #141414 (needs 4.5:1)
  Also silently overrides the plugin's --dark-link-color variable.
- code color: #c0392b !important → 2.4:1 on #2d2d2d (needs 4.5:1)
  The !important fully defeats the plugin's dark-mode rule.
- .wy-form-search-icon: #555 → ~1.7:1 on #0b152d sidebar (invisible)

Add html[data-theme="dark"] overrides that restore proper contrast
without touching the existing light-theme rules:
- Links: defer to var(--dark-link-color, #249ee8) (~6.1:1)
- Inline code: #ff7878 (~4.9:1 on #2d2d2d)
- Search icon: #aaa

Closes #14831

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@skjnldsv skjnldsv self-assigned this May 13, 2026
@skjnldsv skjnldsv force-pushed the fix/a11y-dark-theme-color-overrides branch from 88715fd to 52f7de9 Compare May 13, 2026 06:06
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

📖 Documentation Preview

🔍 Open preview →

No RST documentation pages changed in this PR.

Last updated: Wed, 13 May 2026 06:13:01 GMT

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant