DEV Community

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

Should You Really be Coding in Dark Mode?

sewangco profile image Saji Wang ・4 min read

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!

Discussion (54)

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
sewangco profile image
Saji Wang Author

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
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
hanpari profile image
Pavel Morava

Neither. I prefer a light yellowish color as background and dark color for text. Dark themes or bright light themes are not my cup of tea.

Collapse
sewangco profile image
Saji Wang Author

Do you find that it helps to cancel out the blue light as well?

Collapse
hanpari profile image
Pavel Morava

Well, it should. At least, Microsoft claims so :)

You can try it yourself. My theme Solarized Light in VS Code and it feels like this:

support.microsoft.com/en-us/window...

Thread Thread
goldfinger profile image
Caleb

I love Solarized Light, its such a great theme, thank you for creating it.

Thread Thread
hanpari profile image
Pavel Morava

You misunderstood. I meant that my theme was Solarized Light, not that I created it :)

My theme (is) Solarized Light

It seems I omitted is in my comment.

Thread Thread
defman profile image
Sergey Kislyakov 🇷🇺 🇺🇸

I was using Gruvbox Light (Soft i think) but oh my. Solarized is so much better for my eyes.

Thread Thread
sewangco profile image
Saji Wang Author

Thanks! I'll definitely check that out :)

Collapse
anabella profile image
anabella

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

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
charlibydesign profile image
Charli by Design

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
pontakornth profile image
pontakornth

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
sewangco profile image
Saji Wang Author

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

Collapse
pontakornth profile image
pontakornth

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
codemouse92 profile image
Jason C. McDonald

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

Collapse
sewangco profile image
Saji Wang Author

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.

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
yaireo profile image
Yair Even Or

You should do everything on dark mode because:

  1. it saves energy = green for the planet
  2. it heats the room less

For decades I've had dark wallpaper on windows for those two reasons, and I change whatever I can to dark more to save energy and have less stress on the eyes.

Collapse
mattcobley profile image
Matt Cobley

This is only relevant if you have an OLED display and you use pure black, not just a dark colour like dark grey or dark blue, if I remember correctly.

Collapse
yaireo profile image
Yair Even Or

I had CRT back in the day :) for me flat screens are still a new thing.

Collapse
dezfowler profile image
Derek Fowler

I find switching from an editor in dark mode to either the docs or the website I'm building which usually have a white background to be far too jarring. I think maybe due to getting an after-image on my retinas which makes it more difficult to read what's on the screen.

For that reason, although I quite like dark mode, I just can't use it when doing the job day to day.

Collapse
haouthar profile image
harout_mardirossian

Well, dark mode is not always good for working. Sometimes it's harder to read the code from the dark background. I think the editors’ theme depends on the lighting conditions. I work from home and I like working from the garden or the balcony, so during the daytime under the sunlight it's way harder to read the code using a dark theme, so when I work from outside I switch my IDEs’ theme to light. It's more comfortable for me because the screen reflections don't bother me as much with a light theme. When I go inside I switch to dark again.

Collapse
darkmg73 profile image
DarkMG73

I like the article, but I think you might want to add one more section based on the biggest reason I have heard from coders using dark mode: eye fatigue. The mention of “eye strain” in point one and “blue light” in point two were never really covered in their respective paragraphs.

Blue light is a major part of eye strain. Our eyes absorb light and hold blue light in for relatively long periods of time. This build up is part of eye strain and can lead to larger issues. Dark mode has significantly less light overall, meaning less light absorbed and lower eye strain.

The other major factor in eye strain is our eyes rapidly adjusting to dramatically different levels of light. This happens when we have a dim or dark room and bright screen. So, if a room is dim or dark and we can’t make it brighter (like at night in a bedroom with a sleeping spouse) dark mode and a dimmed screen can ease eye strain significantly.

Just some thoughts you might be interested in adding. This is all based on a lot of research I had done recently, including my eye doctor, because I had been suffering with severe eye strain issues.

Collapse
sewangco profile image
Saji Wang Author

thanks for sharing! really valid point.

Collapse
nicm42 profile image
Nic

I have the brightness turned down really low on my computer, so I have a light theme - I can only read dark themes when the sun is up but hidden behind clouds. A sunny day or night time and the colours don't contrast enough to be able to read anything.

Collapse
domagojvidovic profile image
Domagoj Vidovic

I love light theme because of the better visibility of dark text on light background.

But hey, this is the article for starting a war 🔥

Collapse
biffbaff64 profile image
Richard Ikin

I used to prefer dark mode but, as I've gotten older, I now prefer light mode. I find it easier on my eyes.

Collapse
oo1john profile image
John

I personally like white-theme and adjusting brightness level to fit my eyes :) but I do understand peoples with dark-theme, also... looks cool :D

Collapse
sharpninja profile image
The Sharp Ninja

My preferred color scheme is from the first IDEs like Delphi and QBasic. I even created a theme for VSCode called QBasic Dark from it. It's in the extensions marketplace.

Collapse
akashaj09 profile image
Akash Ahammad

For me, Dark background much better than white background. I tried white background for a while but it's hurt my eyes. While using dark mode I really don't notice any problem.

Collapse
samuelabreu profile image
Samuel Abreu

After O.S. offers dark mode and dark mode browser extensions, I really suffer when I have to use any light theme app/software. Even switch bank due the new bank offers dark mode on their mobile app.

Collapse
unlucky profile image
UnLucky

Idk but this is my review I used dark mode in mobile and laptop the whole time but when you suddenly go to dark room I was unable to see object like you know ig because the brain got used to it and it cannot make diff

Collapse
yarduza profile image
Yarden Even • Edited

I like dark mode so much, if I could I would have dark text on a dark background.

Jokes aside. I've known both sides, I've seen the light and now I live in the dark. I find it very convenient, everything pops at me from the screen, and I feel less bombarded than I do with the light from the background.

As far as sleep goes, I have a terrible relationship with sleep. I can lay in bed for 2 hours if my mind can even slightly wander. No amount of light reducing is gonna fix that problem.

My horrible workaround is to work until my mind is so exhausted, I can't even brush my teeth correctly. That way I just get into bed, and I don't have the strength to argue with sleep, so sleep wins.

Collapse
jenkstom profile image
Tom White

As someone who has been doing this for over 30 years... the eye damage is real. I wound up having to take beta blockers for a while to stop my pupils from spasming every time I looked at a monitor. I'm a big believer in dark mode, and you should be too.

Collapse
tlingit profile image
Tom Pittman

What a weird world we live in. So many people want to join a side.

I think it's cool MacOS will "night shift" your Mac automatically depending on the time of day. iPadOS and iOS do it too, but not many of us write code on those platforms.

Collapse
braindawg profile image
Brian Dunne

It would be interesting to see the study in point 1 repeated with code that's syntax-highlighted. The contrast between colors is much easier for me to differentiate in dark mode, so I find myself having to look more closely at the code itself in light mode to puzzle out what's going on rather than being able to quickly scan through the code structure based on syntax highlighting.

Collapse
imagineeeinc profile image
Imagineee

ive tried using light theme before but it was such a strain on the eye I had to switch back to dark mode, but github dimmed dark is half dark ang light which is a nice theme

Collapse
springhan profile image
Jim Huang

So why not use the two different themes at different time?
Now I'm using light theme during the day and dark one at night.
I think it's a nice choice.

Collapse
sharpninja profile image
The Sharp Ninja

I wonder if the guys at PARC studied this while developing the norms for X.

Collapse
flokoe profile image
Florian Köhler • Edited

I once was supporter of the dark side ;)

After I discovered this article
stitcher.io/blog/why-light-themes-...

I switched and now I much prefer light themes, BUT there are some requirements:

  1. I always sit in bright rooms
  2. If it gets dark outside I turn the lights on
  3. I heavily rely on "nightmode" of my os to filter blue light

On my phone I still use a dark theme as my display is an OLED display to save battery.

Forem Open with the Forem app