Skip to content

Commit 52f7de9

Browse files
skjnldsvclaude
andcommitted
fix(a11y): add dark-theme overrides for hardcoded light-theme colours
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>
1 parent edc929d commit 52f7de9

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

_shared_assets/static/custom.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,31 @@ html[data-theme="dark"] .rst-content img {
153153
box-shadow: 0 2px 8px rgba(255, 255, 255, 0.15);
154154
}
155155

156+
/* Dark-theme overrides — sphinx-rtd-dark-mode sets data-theme="dark" on
157+
<html>. The selectors below restore proper contrast for values that
158+
were hardcoded for the light (white) background. */
159+
160+
/* Content links: #2474a4 gives only ~3.6:1 on the dark #141414 bg.
161+
Defer to the plugin's own variable (= #249ee8, ~6:1 on dark bg). */
162+
html[data-theme="dark"] .rst-content a,
163+
html[data-theme="dark"] .rst-content a:visited {
164+
color: var(--dark-link-color, #249ee8);
165+
}
166+
167+
/* Inline code: #c0392b (dark red) gives ~2.4:1 on the #2d2d2d code bg,
168+
and the !important above defeats the plugin's dark-mode rule entirely.
169+
Use a lighter coral-red (~4.9:1 on #2d2d2d). */
170+
html[data-theme="dark"] .rst-content code,
171+
html[data-theme="dark"] .rst-content tt,
172+
html[data-theme="dark"] code {
173+
color: #ff7878 !important;
174+
}
175+
176+
/* Search icon: #555 is near-invisible on the dark #0b152d sidebar bg. */
177+
html[data-theme="dark"] .wy-form-search-icon {
178+
color: #aaa;
179+
}
180+
156181
/* ICONS LIST */
157182
div#list-of-available-icons > blockquote {
158183
margin: 0;

0 commit comments

Comments
 (0)