Almost invisible colors in dark mode syntax highlighting

In dark mode syntax highlighting some text colors are almost impossible to read. See for example the callable identifiers tuple and map here:

image

It is almost impossible to distinguish the dark color of the text from the grey background. Could you please fix the syntax highlighting color palette? In addition I think it would be much better to make the background color darker.

4 Likes

Live demo:

class do(partial):
    def __rmatmul__(self, iterables):
        self.results = tuple(map(self, iterables))
2 Likes

Agreed, this makes dark mode very difficult to use for me, specifically the color used for builtin functions (print is the most common one, in particular). In order to reliably see it, I end up having to select the text in question, assuming I even notice it at all (and think its just indentation, as has sometimes happened). Is there anyway to customize this?

2 Likes

I’ve noticed this too for a while, but it’s finally gotten to the point where I think we need to do something about it. Dark mode is so much easier on the eyes, but the contrast especially for Python keywords is unreadable. Is this something we can fix in our own instance, and if so, who would be able to make this change?

@EWDurbin or @ambv ?

3 Likes

@brettcannon ?

I’ll contact Discourse and open a ticket with them about this.

4 Likes

It sounds like it should be possible to pick a different syntax highlighting theme that would avoid this issue, and potentially override individual colors with CSS.

Oh, @CAM-Gerlach - your response reminds me that it’s not just keywords in Python syntax highlighting, it’s also the choice of low-contrast blue-ish on black for links.

4 Likes

We’ll look into that as well, thanks. But I want to report that the default colors are bad.

1 Like

Indeed—ironically, the same thing we both noticed on the new dark theme for the PEPs. I think that color should be configurable from Admin > Customize > Colors.

I’ve just come to this section to post about this very topic, when I spotted this thread.

I also see that this issue was reported 5 months back. Am I to assume that it is what it is, or is there a fix coming?

Thanks for the service you guys run; I think that I’ll learn quite a lot by following the posts here.

Be safe.

Peace.

Reported to Discourse:

3 Likes

Good news, Discourse have fixed it! Let’s keep an eye for the next release after v2.8.3.

4 Likes

Hugo, can you check back with the Discourse folks?
The merge announcement at GitHub mentions hljs-builtin-names, which are much better now, but what about hyperlinks? I’ve been making them bolded and often CAPITAL to punch up their visibility.

results = tuple(map(data))

I don’t know if it’s easy or simple to make hyperlinks bold by default in a config file or CSS or something, but that might be a viable option.

The fix hasn’t been released yet: the fix was merged on 18th May, and the last releases (v2.8.3 and v2.9.0.beta4) were on 14th April. If you view the source of the page, you’ll see we’re on 2.9.0.beta4:

<meta name="generator" content="Discourse 2.9.0.beta4 - https://github.com/discourse/discourse version 0fa0094531efc82d9371f90a02aa804b176d59cf">

My topic has since been closed, please can you open a new one at https://meta.discourse.org if there’s more things that need attention? Thanks!

My topic has since been closed.

Yes it has, unfortunately. That’s why I asked if you would follow up with Discourse, otherwise I would have created an account and replied in the thread. I only have a test account over there and you’ve already engaged with Sam Saffron and Charlie ‘Chapoi’ about the coloring.

I’ll set up a real account, open a new topic that references yours, and include some @user calls. This should start the new topic off with enough credibility to get some traction.

we’re on 2.9.0.beta4

Interesting. I didn’t check version but simply tested the code highlighting with markdown. That update seems to have been implemented here.

Unless Václav’s screenshot is especially dark for some reason…

Code block

The code block does look better now:

class do(partial):
    def __rmatmul__(self, iterables):
        self.results = tuple(map(self, iterables))

Before, as mentioned here, the contrast ratio was 1.2. Now it is 2.7 (and still below the minimum AA guidelines are 4.5 and 7.0). I think the fix will bump it to 4.77, but let’s wait for the update.

Hyperlinks

Contrast ratio: 2.69, can be improved. Thanks for opening a topic at Discourse Meta, I’ll comment there too.

3 Likes

That version is not from April. You can see that by using the exact number
https://github.com/discourse/discourse/commits/0fa0094531efc82d9371f90a02aa804b176d59cf.

Tests-passed:
When a new commit is pushed the to the main branch, our build server automatically runs all our tests against the latest code. Once they all pass the commit is added to our tests-passed branch. This is the branch all Discourse sites run by default.

Beta:
Every few weeks we push the current commits on tests-passed to beta. We use beta as a “milestone” to push out a collection of commits we want more sites to be running and test. We also push a beta if we have an important security fix we want sites to receive. When a beta is pushed all sites running on tests-passed or beta receive the “new update available” email. Sites running tests-passed will update to the current tests-passed commits (including any new commits pushed after the beta), while those on beta will not.

Quoted from Updates always come before release notes - #7 by jomaxro - site feedback - Discourse Meta

1 Like

Thank you @ffyH! So the code block fix has now been deployed here :rocket: