DEV Community

Cover image for Should You Really be Coding in Dark Mode?

Should You Really be Coding in Dark Mode?

Simon Pfeiffer on June 09, 2021

There are few debates as contentious in the development and UX world as color schemes. Among developers, however, there seems to be a pretty signif...
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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.

 
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
 
simoncodephere profile image
Simon Pfeiffer

Thanks! I'll definitely check that out :)

Collapse
 
suther profile image
Samuel Suther • Edited

Best mode against eye strains is Off-Mode ^^ - but the downside is, productivity by coding also decrease to 0%

But thanks for this article, I'll think about to give it a try again to switch from now to then between dark and light... and will see on which times a day I'm comfortable with dark or light mode.

Currently I prefer Dark, because it mostly feels less stressing to me.

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
 
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
 
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
 
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
 
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
 
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
 
crusty0gphr profile image
Harutyun 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
 
simoncodephere profile image
Simon Pfeiffer

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
 
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
 
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
 
ingosteinke profile image
Ingo Steinke, web developer

Dark mode can be aesthetically pleasing, and so can light mode, and even more so if the colors match. Often I saw a theme which looked promising at first glance but turned out that I didn't like the palette. In general, I prefer lighter themes!

I like to switch themes to adapt to the surrounding environment, as I find dark themes mostly too low-contrast when coding in the sunlight. I also enjoy sepia / yellowish / espresso themes, but my current favourite is a light theme with deep pink accent colour: WebFreak's Cute Pink Light Theme for VisualStudio Code and VS Codium.

When I started to use PhpStorm as my default IDE again, I found no theme to match, which is why I started to copy Cute Pink Light as a theme for PhpStorm / WebStorm / IntelliJ IDEA. It's already released, but still work in progress. So, if someone likes pink light themes, and has experience in customizing IntelliJ colors, I'd be very glad if they help me to finish the theme.

Collapse
 
tobiobeck profile image
Tobi Obeck

I am wondering whether the proofreading study (Piepenbrock 2013) does transfer to coding. I assume it is focused on reading text in general.

From my personal experience I like dark themes, because different keywords are highlighted in distinct colors (bright green, hot pink, yellow...) which are easy to differentiate. In light themes most of the text colors look quite similar (dark sth.) almost the same to me.

I'd assume in dark themes the code can be easier parsed as the different kinds of keywords and it is therefore easier to understand the meaning of the code. For example while scrolling and skimming through the code you see all the green function signatures immediately.

Someone should conduct a study specifically on reading code with dark vs light themes. Maybe there the results would be different.

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.

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.

 
goldfinger profile image
Caleb

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

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
 
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
 
simoncodephere profile image
Simon Pfeiffer

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

Collapse
 
mistval profile image
Randall

I feel more comfortable using dark mode, and at night I enable Windows night mode which makes my screen very red, and it has improved my sleep significantly.