question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Contrast of Code Examples, Dark Mode

See original GitHub issue

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects

What specific section or headline is this issue about?

This is about the site wide CSS for dark-mode code colors

What information was incorrect, unhelpful, or incomplete?

First, thank you so very much for adding a native dark mode!!! the level of my impaired vision makes light mode difficult, and the available plugins are not as ideal as a native scheme.

That said, there is one little bit of errata in the form of CSS color variables.

The code coloring in dark mode has punctuation as too low of a contrast:

examples of code coloring, too dark punctuation

I didn’t see the periods in-between the object name and property. And while the other punctuation is more visible, there really isn’t enough contrast.

Note: just as an FYI, WCAG 2 contrast math does not correctly calculate contrast for dark mode, though there are other contrast metrics that do. Lc, aka perceptual lightness contrast is the value I’ll use here as it calculates dark-mode.

The punctuation color is currently at #9e9e9e, and against that #343434 background, is Lc -43.7 (the minus sign indicates dark mode, aka negative polarity). Ideally, for smaller fonts that are content that should be readable, we want to see Lc 60 or more, so changing the punctuation color to #bdbdbd helps things, and is still distinctly different that the other text colors for differentiation.

As now @ #9e9e9e examples of code coloring, too dark punctuation Boosted #bdbdbd examples of code coloring, lightness increased for Lc 60

This also applies to comments in the code. While in a dev environment, we might want to keep the comments at a very unobtrusive level, here in the documentation pages, I’d argue that the code comments are “particularly important content” and should be at least at Lc60:

As now @ #9e9e9e examples of code coloring, too dark comments Boosting to #bdbdbd examples of code coloring,  lightness increased for Lc 60

Subtle

Obviously the differences I’m suggesting above are subtle, but nevertheless meaningful — one step more would be to bring punctuation up to Lc75, which is better for reading:

Lc75: #d6d6d6 examples of code coloring, lightness increased for Lc 75

Though now the punctuation lacks distinction, reducing the blue channel adds distinction, including for the common color vision types deutan and protan.:

Less blue: #d6d696 examples of code coloring, blue reduced for more yellow and more distriction

Thank you for reading,

Andy

What did you expect to see?

Simply better contrast as described above.

Do you have any supporting links, references, or citations?

Yes, Bridge-PCA is a contrast calculator that is backward compatible to WCAG 2 contrast, except that it calculates dark mode correctly: www.myndex.com/BPCA/

And here’s a list of resources for APCA, the candidate contrast method for WCAG 3 — while not the official recommendation, it does outperform WCAG 2 particularly for dark mode. git.myndex.com/#accurate-contrastusing-the-apca

Do you have anything more you want to share?

Some of these considerations may apply to the light mode scheme as well. Also, I’m posting as an issue, and not a PR as I know you created the dark mode recently, and I’d assume those involved would prefer looking into this.

Thank you for reading,

Andy

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
schalkneethlingcommented, Jun 15, 2022

Hi @Myndex, thank you for filing an issue. The problem described here is not related to a content change but is something that needs to be addressed by engineering. We file engineering-related issues on the Yari repository. As such, the issue will move over to Yari.

0reactions
schalkneethlingcommented, Jun 16, 2022

Hi @schalkneethling thank you, please let me know if there are questions or if I can be of further help.

Will do, thanks so much @Myndex. Hopefully we can resolve this soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dark mode with design tokens - UX Collective
High contrast mode is a dedicated mode that users can enable independent of dark or light mode. However, it works a little bit...
Read more >
A Complete Guide to Dark Mode on the Web - CSS-Tricks
Dark mode ” is defined as a color scheme that uses light-colored text and other UI elements on a dark-colored background. Dark mode,...
Read more >
Should You Really be Coding in Dark Mode?
I prefer dark mode because it is better to serparate code and non-code application. Besides, good theme can help you. For light mode,...
Read more >
Dark theme - Material Design
A dark theme is a low-light UI that displays mostly dark surfaces. ... Contrast: Dark surfaces and 100% white body text have a...
Read more >
Dark Mode for Developers | Wijmo - GrapeCity
In the design world, dark mode is the new black. Also known as the light-on-dark-color scheme, night mode, or black mode, dark mode...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found