Repository navigation
DOC Use different themes for code syntax highlighting - #35059
DeaMariaLeon wants to merge 6 commits into
Conversation
|
I looked at https://output.circle-artifacts.com/output/job/8a136c6d-99bb-4213-88a2-0a1299751a42/artifacts/0/doc/auto_examples/release_highlights/plot_release_highlights_1_4_0.html (randomly picked an example page) to see the new highlighter in action. For me it looks like this:
This looks different from what I was expecting to see based on https://quansight-labs.github.io/accessible-pygments/ There is a lot of purple text which feels hard to read/scan because everything is purple. I was somehow expecting more different colours for the different part of a line :-/ Below is a screenshot of what is currently on the 1.10dev docs build
Here what is purple with the new theme is black. So maybe everything is as it should be with the new theme? If that is the case, then I find it harder to read than what we have. Christian can you take a look as well and maybe explain what it is that you don't like/find hard to read/parse? |
|
Everything that is "generic" (every
There is more red bellow, because pygments recognises the Python words (and so, they are not generic):
The image above is from here: EDIT: EDIT2: about the background: #34484 (comment) |
|
I forgot: we could change what is purple to black if we wanted, by modifying |
|
I agree, as much as I like purple, it is a bit much purple. estimator=MyEstimator(param=0)The variable NB: Interesting, here on github it is not that purple. |
|
Yeah, it seems that Pygments doesn't recognize scikit-learn's methods, so it styles them as "generic". Every token ends up generic. I also think that if we changed the text from purple to black in the theme we're trying, the contrast would fail accessibility checks as well. So we'd need to add our own background color, which would have to go in the custom.css file (and we want to avoid that). We may need to try another theme. |
|
I'm off for a few days. I'll run some experiments when I'm back. |
|
I used a11y-high-contrast-light and dark. |
|
Friendly ping to @lorentzenchr since I'm bugging you in other places. |
Conclusion: |
There is no fix that I know of. Please see comment for more details. |
|
Sad times, I find having the class names in a different colour adds readability/scan-ability. And because I don't care too much about the background colour, I'd vote for keeping main :-/ |
|
It seems that the best action is no action then. It was fun while it lasted. 😉 Closing. |
|
@DeaMariaLeon Thank you nevertheless. |








Reference Issues/PRs
Addresses a conversation that started here: #34376 (comment)
What does this implement/fix? Explain your changes.
Selected are (for now)
accessible-pygmentswas already a dependency (pydata-sphinx-themerequires it). So, we didn't need to add it.Introduce yourself
AI usage disclosure
I used AI assistance for:
Any other comments?