Is Coding in Dark Mode better for Your Eyes?

Among developers there seems to be a pretty significant skew towards coding in a light or dark mode.

There is not a scientific proof that one color scheme is going to be better than the other so your theme therefore should come down to what is best for you. But here are a few facts to be aware of if you still didn’t build strong opinion. 

Focusing depend on the light

Focusing is largely affected by how much light is coming into our eyes and how we focus that light.

If a lot of light is coming in (like when using light modes) eye pupils contract allowing less light in, creating a wide depth of field. Meaning, everything is in focus.

If this is inverted, less light coming in and our eyes have to put more effort into focusing on individual objects. And when you are reading, you want everything to be in focus. You need that light background for the pupil to work appropriately to minimise amount of light coming in.

Light scatter

White text on black is a sort of a halo effect where the light from each letter glows light around it making it difficult and more time consuming to read. This is the complete opposite of light mode which is easier and more comfortable to look at for a long time.

How your brain will process your code in different mode

Dark text on a light background is interpreted as language to your brain. Meaning your brain will create memories and easily string these memories together as a story. This is why books are all typically dark text on a light background. It makes it much easier for your brain to process and retain this information.

Light text on a dark background is interpreted as symbols to your brain. Meaning your brain sees them as objects and recognizes shapes rather than interpreting them as language or a story to convert to memories. So, with light text on dark background your brain will remember where blocks of code will be in the overall structure of a program rather than what the code may do.

Use the color scheme depend on environment light 

You should use a light color scheme if you write code during the day in a well lit room with lots of backlighting, white walls etc. This is an environment where a white background color scheme is going to be much easier on your eyes.

You should use a dark color scheme if you primarily program at night, in a dark room with no lights on or very few at a minimum.

The goal here is to make it so your eyes have to adjust as little as possible to the light being projected into them. You want to reduce strain on your eyes caused by them adjusting to more or less light and allow your eyes to relax and stay the same while you're writing code.

For most developers dark mode is more aesthetically pleasing but I definitely notice how it can be harder to read.

In the end, there's no evidence that using light or dark modes in text viewers has any effect on long-term eye health at all, but it should be studied more.

You may also like

June 17, 2024

Quests in Code: Is Game Development the Ultimate IT Career Move for You?

Game development has captured the imagination of IT students and professionals alike. The video game industry, now a multi-billion dollar behemoth, is booming like never before.  But why is it suddenly the talk of the tech town? Is it the allure of cutting-edge tech or the tantalizing promise of dream jobs? Get ready to find […]

June 20, 2024

Mastering Client-Oriented Roles: Expert Advice for Junior Developers

Ever wondered what makes the magic happen behind the scenes in global software companies? Spoiler alert: it’s the client-oriented roles! These are the glue that keeps everything together, ensuring clients’ needs are met and expectations exceeded.  This blog post will share concrete, experience-based insights to help new employees thrive in these crucial positions. Whether you […]

June 13, 2024

Bugs and Scalpel Slips: Why Software Development Demands Surgical Precision

A surgeon and a programmer walk into a bar. But it’s not the start of a joke—it’s a scenario highlighting both professions’ weighty responsibilities. Surgeons, with their scalpels, work with life and death hanging in the balance. Armed with code, programmers might not hold lives in their hands, but their mistakes can still wreak havoc […]