Accessibility - Fix code syntax highlighting contrast errors (dark mode) - #34484
Conversation
cakedev0
left a comment
There was a problem hiding this comment.
(I wanted to approve, sorry for the noise)
|
Thank you! |
|
As mentioned during the meeting, in an ideal world this would be taken care of by the pydata-sphinx-theme and benefit plenty of other projects' documentation, rather than us having to resort to what feels like hacks 😅. Out of curiosity, Do you have a reference for why this is complicated to do at the pydata-sphinx-theme as you mentioned during the meeting. If there is no related issue in pydata-sphinx-theme, I am thinking you could create one as well ... |
betatim
left a comment
There was a problem hiding this comment.
I'd be happy to have these changes via custom.css and, as Loic pointed out, see if they can be upstreamed so that more people benefit from these improvements.
This is what's going on:
In the screenshot bellow "background-color: var(--pst-color-surface)" is what sets the background I'm trying to change.
For more details: The So, an issue to
I don't know if I should share more details @lesteve, as during the call you also asked why this happens and after I talked you replied "who cares?". Also those were "too many details". EDIT: I corrected the link to |
|
Even if we can't come with a solution that would work for pydata-sphinx-theme directly it would be worth to open an issue pointing out that the syntax highlighting could be improved to make it more accessible. |
|
I'll merge this as it looks like there is agreement that we should fix this and that this PR implements one way to fix it. The discussion about opening an upstream issue (or not) can continue even if this is merged. |
True. It occurred to me only after I sent my previous comment. Thanks a lot! |
|
Thanks a lot for the details! I would suggest you create an issue explaining the problem in the pydata-sphinx-theme repo so hopefully they or maybe someone else (maybe @DeaMariaLeon even one days who knows what the future holds 😉) can fix it. |
|
BTW: these themes are already accessible in case we need/want to switch from I would need to build the docs locally to check that they pass the contrast checks. |
|
I don't understand the details, but we are already using If that's the case there are two things:
|
Not quite. I think they are just different themes, and it may be much simpler to install them. I found out about those themes after the fix for the light theme was already done. EDIT: I need to check my assumptions above (that it may be much simpler to install). |
|
I am pretty sure the end goal is to improve accessibility in pydata-sphinx-theme, this is part of the NASA ROSES grant. |
We already have the dependency: build_tools/circle/doc_linux-64_conda.lock:207: build_tools/circle/doc_min_dependencies_linux-64_conda.lock:193: |

Reference Issues/PRs
Continuation of #34376 (comment)
Towards: #34366
What does this implement/fix? Explain your changes.
Changing the background colour of the code syntax highlighting when using dark mode.
The contrast accessibility errors in the code are now gone.
I used FireFox to test. I couldn't find an online tool that tested in dark mode.
It's equivalent to #34376.
First time contributor introduction
AI usage disclosure
Any other comments?
This PR changes from this (just see the code block please):

To: