Why 92% of the developers prefer dark backgrounds for their code editors? 🤔

Not a long time ago, we had a poll where 92% of the 200+ participants had given a preference for “light text on dark background” code editors, in comparison to “dark text on light background” code editors.

I’ve done some reading while scouting for specific reasons behind the result. Before I give you my take on this; here are a couple of responses that I want to highlight.

@bboydflo elucidates his preference

I prefer dark, because of better contrast. I have my screen close to the window, usually work in the morning, and I find that a better contrast (aka a dark theme) makes it easier for me to spot things in my code.

There was a follow-up question, asking developers for their rationale on this result, which ensued a great discussion. The following answer by @sportebois seems to hit the nail spot on.

In a low-light environment, your screen is the main light source. Hence you'd prefer a dark theme to avoid making your eyes tired.

In a bright environment, the low-contrast of a dark theme tires your eyes more than a light one, because of its low contrast.


The Role of Contrast/Brightness

One of the key aspects, prominent for the reason behind these preferences is an important design principle called Contrast. Quantified as contrast ratio, it is the degree to which two or more elements differ from each other.

Eye strain associated with looking at a computer screen has to do with the contrast ratio between the brightness of light on your computer screen and the brightness of light in your environment. When the light on your display mimics the light in the environment, eye strain is minimised.

Adaptive brightness technology works on the same principle. Almost all smartphones today have sensors to detect the intensity of light in our surroundings, and adjust brightness accordingly to minimise the contrast ratio between the display’s light and the light in your environment; for a minimised eye strain.

Food for thought! Is it then too far fetched to correlate that a majority of developers prefer low-lit environments, while coding? 🤔

For the sake of completeness, there is one more factor that has a physiological effect on you — and that is, the colour temperature of your display.


The Role of Colour Temperature

If brightness is one part of the characteristic of a light source; the other part is colour temperature. Colour temperature has nothing to do with the temperature of your surroundings. Measured in degrees Kelvin, the scale goes backwards: the higher the colour temperature, the “cooler” the light gets, and the lower the colour temperature, the “warmer” the light gets.

There is strong research backing the fact, that the warmer temperature, shorter wavelength, blue coloured displays suppress the sleep-inducing hormone melatonin; thus affecting your sleep cycle.

In the modern age of technology it is not uncommon to come home after a long day at work or school and blow off steam by reading an e-book or watching television. Lately, however, scientists have been cautioning against using light-emitting devices before bed. Why? The light from our devices is “short-wavelength-enriched,” meaning it has a higher concentration of blue light than natural light—and blue light affects levels of the sleep-inducing hormone melatonin more than any other wavelength.

You can optimise your monitor’s colour temperature using a free software called F.lux, which uses your location to automatically adjust the temperature of your display based on the time of the day.

Flux screenshot

@JanVladimirMostert uses F.lux

A light theme combined with F.lux makes the light theme usable across day and night.

During the morning hours, f.lux keeps your monitor relatively cool with a default colour temperature of 6500K. Your brain tends to associate blue light with daylight.

This shorter wavelength blue light suppresses the sleep-inducing hormone melatonin. To fix this, during night hours, f.lux reduces the colour temperature to a warmer, more yellowish glow (3400K); thus aiding you with minimal to no disruption in your sleep cycle.


I’ll leave you with the Kruithof curve, which is a graph plotted between the brightness, and the colour temperature of a specific light source; to describe a region of “pleasant” brightness and colour temperature values.

Kruithof curve