Over on the Python Discourse, when using code blocks in dark mode, some of the highlighting makes the code unreadable.
For example:
class do(partial):
def __rmatmul__(self, iterables):
self.results = tuple(map(self, iterables))
Looks like this where tuple
and map
are barely visible:
(There’s no difference if I add python
after the first triple backticks.)
Chrome’s devtools reports a contrast ratio of 1.2, where the minimum AA guidelines are 4.5 and 7.0 :
[screenshot removed due to new user limits]
(The WAVE Web Accessibility Evaluation Tool wouldn’t run on the page.) [link removed due to new user limits]
This with default Discourse settings.
I know it’s possible to pick another theme, but please could you make it so the default syntax highlighting to work well in dark mode? This is also an accessibility issue.
Original discussion at:
In dark mode syntax highlighting some text colors are almost impossible to read. See for example the callable identifiers tuple and map here: It is almost impossible to distinguish the dark color of the text from the grey background. Could you...
Reading time: 1 mins 🕑
Likes: 19 ❤
Thanks!
8 Likes
sam
(Sam Saffron)
May 9, 2022, 7:28am
2
We will get this styling sorted! thanks for letting us know
5 Likes
chapoi
(Charlie)
May 18, 2022, 1:59pm
12
Thanks @hugovk for reporting this.
This PR fixes the highlight colour for dark theme.
discourse:main
← discourse:fix-highlight-colour-readability
opened 12:44PM - 18 May 22 UTC
Colour for hljs-builtin-name highlight wasn't very readable in dark mode
https:… //meta.discourse.org/t/almost-unreadable-code-highlighting-in-dark-mode/226334/8
before ("tuple" & "map"):
<img width="697" alt="image" src="https://user-images.githubusercontent.com/101828855/169048399-356745d5-f5c8-40d5-8816-8742a4c7eff5.png">
after:
<img width="712" alt="image" src="https://user-images.githubusercontent.com/101828855/169048330-e8edcf6d-8635-482d-8f76-b4946dba880e.png">
This topic will close in a few days.
7 Likes
hugovk
May 18, 2022, 7:36pm
13
Thank you for the quick response and fix!
4 Likes
chapoi
(Charlie)
Closed
May 21, 2022, 7:00am
14
This topic was automatically closed after 2 days. New replies are no longer allowed.