Skip to content

Commit a619dfa

Browse files
authored
Fix diff colours in docs (#612)
#582 upgraded Furo, along with it's new accessible-pygments dependency (pradyunsg/furo@be0072d). Unfortunately, accessible-pygments doesn't support the `diff` code block and is missing some CSS (Quansight-Labs/accessible-pygments#31), so diffs look like: <img width="756" height="230" alt="image" src="https://github.com/user-attachments/assets/96eb6002-f162-4128-8920-fdc8be8c96d5" /> <img width="746" height="224" alt="image" src="https://github.com/user-attachments/assets/ef9bc771-ba58-49f9-899a-12564959945c" /> https://django-upgrade.readthedocs.io/en/latest/fixers.html#django-4-2 Instead, set our own colours: <img width="748" height="227" alt="image" src="https://github.com/user-attachments/assets/fa5e1855-dcdf-44c0-9083-d048eb866896" /> <img width="752" height="232" alt="image" src="https://github.com/user-attachments/assets/5c57febb-4b3a-45fe-8ce8-93e45b96ea24" /> I've confirmed these all exceed the WCAG AA min ratio.
1 parent 348eda4 commit a619dfa

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

docs/_static/custom.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.highlight .gd { color: #A40000 !important; }
2+
.highlight .gi { color: #116600 !important; }
3+
4+
@media (prefers-color-scheme: dark) {
5+
body:not([data-theme="light"]) .highlight .gd { color: #FF6B6B !important; }
6+
body:not([data-theme="light"]) .highlight .gi { color: #69DB7C !important; }
7+
}
8+
body[data-theme="dark"] .highlight .gd { color: #FF6B6B !important; }
9+
body[data-theme="dark"] .highlight .gi { color: #69DB7C !important; }

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
# a list of builtin themes.
6161
#
6262
html_logo = "_static/logo.svg"
63+
html_static_path = ["_static"]
64+
html_css_files = ["custom.css"]
6365
html_theme = "furo"
6466
html_theme_options = {
6567
"dark_css_variables": {

0 commit comments

Comments
 (0)