Skip to content

Commit 1235df5

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 8445847 commit 1235df5

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
@@ -164,6 +164,31 @@ html[data-theme="dark"] .rst-content img {
164164
box-shadow: 0 2px 8px rgba(255, 255, 255, 0.15);
165165
}
166166

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

0 commit comments

Comments
 (0)