DEV Community

Cover image for Should You Really be Coding in Dark Mode?
Simon Pfeiffer for Codesphere Inc.

Posted on

Should You Really be Coding in Dark Mode?

There are few debates as contentious in the development and UX world as color schemes. Among developers, however, there seems to be a pretty significant skew towards coding in a light on dark mode (This poll found that ⅔ of surveyed developers prefer to use a dark mode in their code editor).

Alt Text

Dark mode advocates cite a number of benefits, including reduced eye strain, better sleep, and reduced power consumption. While many of the arguments for dark mode undoubtedly have merit, there is far from a scientific consensus on many of its benefits.


A Little Bit of History

While we might think of dark mode as a relatively new trend, it was actually the original color scheme that was used for computers. Most early computers used light text on dark background in order to save power. As computers became more consumer-friendly, however, developers began to use black text on white backgrounds to imitate the black ink on white paper that most people were used to.

More recently, countless devices, websites, and apps have added support for dark mode for both optical and aesthetic reasons. Software developers, who spend most of their work time staring at computer screens, have been some of the most fervent advocates for dark mode.


1. Eye Strain and Readability

The first argument for dark mode that's worth taking a look at the claim that dark mode is better for your eyes. While there is no doubt that using light mode in a dark room can be blinding, there also seems to be evidence that our brains are just better at reading and comprehending black text on a white screen.

For example, A 2013 study by Psychologist Dr. Cosima Piepenbrock looked at how adults with normal vision performed at visual acuity and proofreading text across dark and light color schemes. The study found that:

"Pupil sizes were smaller and proofreading performance was better with positive(Dark on Light) than with negative(Light on Dark) polarity displays"

In other words, for substantial digital tasks where you are attentively reading text(Such as coding), *having dark text on a light background (i.e. light mode) can help you focus and comprehend better. *

What this means in practice is that your eyes and brain may have to work harder to read and write code if your IDE is in dark mode.

2. Blue Light and Sleep

Another commonly cited claim is that using your IDE in dark mode reduces blue light consumption, and therefore can help you sleep. While dark mode definitely does reduce blue light, blue light may not be the primary culprit that actually messes up your sleep schedule.

A 2019 study by the University of Manchester found that blocking blue light only slightly improved people’s sleep patterns. Instead, the real culprit is the use of warmer colors(Like reds and yellows) at night, which trick our brain into thinking it's daytime.

If you want to get better sleep, dark mode may in fact help, but the real solution is to not use screens altogether before going to bed.

3. Power Consumption

Another argument for using dark mode in your IDE is that it can save you money on your power bill. If you are using an OLED display, which most modern monitors do, then this is definitely true.

It is probably important to note, however, that if you are developing software that is computationally heavy, like rendering 3D graphics or training and using machine learning models, the reduced power consumption from dark mode probably won’t make any sort of noticeable dent in your power bill.

4. Accessibility

Regardless of what you personally prefer while you code, you should always add support for both dark and light modes in the software that you build. Many people who have certain color blindness or eye conditions can find one of these themes extremely hard or even impossible to use. Giving your users flexibility is therefore very important.


Conclusion

In summation, the jury is still out on whether dark mode is actually better for coding. While it might save you a tiny amount of power and, if you are using it at night, marginally help your sleep schedule, these benefits don’t seem to be that substantial. In addition, reading dark text on a light background may help you read and write code more efficiently.

Your theme therefore should come down to what is best for you, because there is not a scientific consensus that one color scheme is going to be better than the other. If you think dark mode looks sleeker and you are doing a lot of coding at night or in the dark, then go ahead and use dark mode. If you prefer the readability of dark text on a light background, then go ahead and use light mode.

So what do you prefer and why? Personally, I think dark mode is more aesthetically pleasing but I definitely notice how it can be harder to read.

Let us know in the comments what you think!

Top comments (57)

Collapse
 
mattcobley profile image
Matt Cobley

I think there was also some research that said that if your are in a light environment then having your background match this is less straining on your eyes, and vice versa. So during the day in a well lit room light mode is likely to be more comfortable, but at night or in a dark room then dark mode would likely feel better. There seems to be a misconception that dark mode is generally better to prevent eye stain, and that's clearly not true.

Collapse
 
rafh profile image
Rafael Heard

I like this comment because I code in various locations. If I'm outside and it's sunny I frequently switch to a light theme. If I'm in my office where it's a bit more dim I'll apply a dark theme.

Collapse
 
simoncodephere profile image
Simon Pfeiffer

Ah okay, thats a valid point! I definitely find myself adjusting my color scheme according to the time of day. Thanks for pointing that out!

Collapse
 
mattcobley profile image
Matt Cobley

No problem. Apologies I've not got any specific references - the info is out there though.

Another interesting point is that if you have astigmatism then it can be more difficult to comprehend the white text on dark background due to the colours bleeding together (or something similar to that). It's certainly not one size fits all.

Collapse
 
th0rgall profile image
Thor Galle

I've been doing this switching based on the light in my environment too, it's indeed what gives me the most comfort.

I got a system-wide shortcut set up using a macOS Automation and this LifeHacker guide, so with one key press the whole system and all apps change from light to dark, or vice versa. Then DarkReader does the same for the web browser :)

A good thing that dark mode support became mainstream!

Collapse
 
ashiqsultan profile image
Mohamed Ashiq Sultan

I see, I always use dark mode, thought just adjusting brightness should be enough.

Collapse
 
dima2306 profile image
Dimitri Simonishvili

True, while I code in daytime, I've bright colors palette in my IDE. If I've to code at evening when there is no much light, I prefer dark theme.

Collapse
 
timfish profile image
Tim Fish

Most modern monitors are not OLED yet simply because of the cost of producing panels that large. For example, Apple do not sell an OLED MacBook yet. OLED is becoming pretty common for high end phones.

Most modern monitors do use LED backlights and where these support dynamic contrast they will use less power in dark mode.

Collapse
 
javanpohl profile image
Javan Pohl

LED monitors will only offer energy saving benefits with dark mode if they have "local dimming" (which the ability to turn off certain led nights in response to the image being displayed). And it doesn't appear that this is a very common, or well implemented, feature on PC monitors rtings.com/monitor/tests/picture-q....

Another thing to note with OLED is that the technology is inherently susceptible to burn in. They are not a wise choice for monitors.

Collapse
 
coderslang profile image
Coderslang: Become a Software Engineer

100% agree. Wanted to say the same, but then used search :)

Collapse
 
pontakornth profile image
Pontakorn Paesaeng

I prefer dark mode because it is better to serparate code and non-code application.
Besides, good theme can help you.

For light mode, I prefer some not to bright such as Solarized Light theme or any theme without white background. White background is too bright for coding.

Collapse
 
biffbaff64 profile image
Richard Ikin

I find Sepia is a good alternative to white themes.

Collapse
 
simoncodephere profile image
Simon Pfeiffer

agreed! Which is why I love that Codesphere's light mode is predominantely grey toned.

Collapse
 
pontakornth profile image
Pontakorn Paesaeng

It turns out that Quiet Light is a bit better for me. I try using something live Solarized light or gruvbox. VSCode looks "incorrect" with those themes. It likes my screen display wrong color.

Quiet Light for light theme and Nord for dark theme.

Collapse
 
rasmus_anthin_791fc2cec73 profile image
Rasmus Anthin

Yes. IMO, Solarized Light is one of the best light mode themes out there. It's very easy on the eyes.

Collapse
 
mazentouati profile image
Mazen Touati • Edited

I prefer dimmed themes like Solarized Light which is Yellowish or Creamy (@hanpari already mentioned this)

Dark themes hurt my eyesight. It may be a medical condition or continuous fatigue. However, when I use a dark theme. I start to have double vision with texts. It becomes harder to read in a way that leads to a loss of focus.

On the other hand, light themes are too bright to handle. Thus, it leads us to an in-between choice. We get a subtle contrast and a reduced exposure to bright lights.

Collapse
 
anabella profile image
anabella

Somebody had to advocate for us light-moders out there!

Collapse
 
charitygamble profile image
Charity Gamble

I prefer dark mode. I have some light-sensitivity issues with my eyes and reading dark on light seems to cause more discomfort than light in dark for me. It’s also better for me when I have a headache.

Collapse
 
jsnanigans profile image
Brendan Mullins

I care more bout how good the contrasts are and how quickly I can differentiate different parts of the code, but after reading this I will try some light themes again, I have been using dark mode for years so I might be a bit biased

Collapse
 
wujin1992 profile image
Liam Wang

One of my colleagues said, "We love dark mode since bugs like the light." ~LOL~
For some reason, I love working during the night, just my habit, and I love dark theme in a dark room. It's a bit straining to look at a light screen during the night.

Collapse
 
rasmus_anthin_791fc2cec73 profile image
Rasmus Anthin

I find that programming is generally best done during the dark hours of the day. :)

Collapse
 
codemouse92 profile image
Jason C. McDonald

Dark mode is, in fact, sometimes very helpful for comprehension w/ dyslexia. (Speaking from experience.)

Collapse
 
simoncodephere profile image
Simon Pfeiffer

wow, interesting. Would love to find out more behind the science of that.

Collapse
 
codemouse92 profile image
Jason C. McDonald • Edited

It's a contrast thing.

I have as much trouble reading pure white-on-black as I do black-on-white. My own ability to handle that much contrast in connection w/ my dyslexia varies from day to day. I was on traditional black-on-white yesterday, today I need dark mode white-on-grey. Other people are more consistent in their dyslexia symptoms; my dyslexia just happens to be largely via a traumatic brain injury, so the symptoms fluctuate depending on other factors as well.

In any case, higher contrast is harder for many people w/ dyslexia to read. One of the best solutions is to change the background color to something other than white or black, and the ideal background varies from person to person, and situation to situation. ("Solarized" themes are often nice.) A lot of dark modes aren't just pure white-on-black anyway, whereas light mode is virtually always black-on-white. That's why I gravitate toward them.

I like Visual Studio Code, and Dark Reader in my web browser, for this reason! Both give me quite a bit of control over the colors. That's the important part ultimately. On LibreOffice, I'll typically change my document background (Tools > Options > Application Colors) to be light green, light yellow, or light blue.

Understand, though, "dyslexia" is something of a cover-all term. You'll be hard pressed to find two dyslexic individuals who experience it the same. Different severities and forms demand different techniques to mitigate; high contrast just happens to be one of the more common triggers.


I also saw in another comment something about matching your environment. I'd have to agree. I tolerate brighter themes better in daylight, and darker themes better at night. My eyes get quite tired if I get that backwards, which only exacerbates my dyslexia.

Collapse
 
ama profile image
Adrian Matei

Use flu.x and you don't have to worry about dark mode again...

Collapse
 
nicm42 profile image
Nic

I love flu.x. It's amazing how much I don't notice the colours change on my screen until I turn it off and it's suddenly so bright.

Collapse
 
moopet profile image
Ben Sinclair

f.lux and its alternatives solve a different problem, and have their own drawbacks.