Text Editor Color Schemes (& syntax highlighting)

When my eyesight started getting noticeably worse, I started paying a lot more attention to “visual ergonomics.” Monitor distance, height, angle, etc. That’s a whole other discussion, but today I’d like to share some thoughts on colors to point anyone interested in the right direction, and perhaps save you some research time. Particularly with the rising popularity of dark/night color schemes.

We all read a lot of text on our screens. Any many of get headaches and eye fatigue from doing so. Is there something we can do about that? If we can’t eliminate it entirely, is there something we can do to mitigate the effects of staring at a screen for hours on end?

The default way to read on a computer is dark text on a light background (positive polarity). You may have noticed a nearby programmer using light text on a dark background (negative polarity). If you code, you may have tried some darker colors yourself. Negative polarity is very trendy among people who look at a display for extended periods of time. There are reasons for that, but it’s not the answer for everyone. It does, however, tell us something important about why our eyes start to hurt when we look at a screen for a long time.

When your eyes face a computer screen, you’re staring at a light source. Your pupils contract, and like any muscle, can become fatigued. When someone uses a negative polarity color scheme with light text on a dark background, less overall light means a more relaxed pupil. So negative polarity is generally more comfortable over prolonged periods.

But negative polarity is not universally “better” for the eyes, especially for those with astigmatism. Astigmatism is an irregular curvature of the eye’s cornea or lens that results in image blur. Some reports estimate that 95% of the world’s population has some detectable amount of astigmatism, though in most people it is not severe enough to require glasses. If you have astigmatism, you may notice that negative polarity text is particularly fuzzy. One reason for this: a more relaxed pupil uses more of the cornea and lens, so irregularities in their shape are more pronounced (there’s actually a lot of science behind this phenomena, from point spread to spacial summation to the packing density of rods vs cones and their distribution on the retina… but it all adds up to worse focus in lower light, when the pupil is relaxed).

To put this into quantitative terms, a 1980 study by Bauer and Cavonius showed that participants recognized characters 26% more accurately with dark text on a light background. That’s fairly significant. Given the above, it should be no surprise that astronomers often view the night sky with inverted colors (black stars, asteroids, etc against white space).

Another factor is the “irradiation effect” noted by Hermann von Helmholtz, which in summary states that we observe dark objects on light backgrounds as smaller and more well-defined than light objects on dark backgrounds.

But a light background doesn’t have to mean white. Again regarding astigmatism, shorter wavelength (blue) light halates more than the others. So my preferred color scheme uses a tan-ish background. It works very well for me.

I do most of my coding in IDLE (a lot of people like to pooh-pooh idle, but IMHO if you need a fancy IDE to write your code, it’s not IDLE that needs to improve). The default light scheme looks like this:
image

And I find this to suite me quite well (I use the same colors where applicable for the command console, npp, etc):

image

There are a lot of websites and papers I could direct you to for further reading, but if you’re just going to pick one, this is a fairly in-depth, .edu scholarly explanation:
https://webvision.med.utah.edu/book/part-viii-psychophysics-of-vision/visual-acuity/#introduction

Anyway, I hope that helps at least a few people improve their visual experience. If you think you have a good color scheme, please share it!

10 Likes

What about f.lux?

11 Likes

i came to the same conclusion like you, and pretty much use the same color palette wherever i can…
for example in visual studio code there is solarized light theme which i always use, and it looks pretty much the same as the one you are using.
dark background is definately not the ultimate answer as it makes some peoples eyes (mine also) more tired.

also i was using f.lux for years now, and its great. i do pretty much the same yellowish/tan halogen light on flux and my eyes are not that strained when looking at the screen

7 Likes

Agreed, Solarized Light definitely has the right idea, and I certainly considered it before deciding to go the custom route. Not enough contrast for my preferences, though (they darkened the lights and lightened the darks).

Not that it ultimately matters, but I also insisted on using only named HTML standard colors in my scheme (once I had the idea in my head, I could not escape from it):
Using standard named colors: [& uses special background]

  • background: Beige (RGB 245, 245, 220; #F5F5DC)
  • comments: Maroon (RGB 128, 0, 0; #800000)
  • code context: Black [& LightGray (RGB 211, 211, 211; #D3D3D3)]
  • keywords: Sienna (RGB 160, 82, 45; #A0522D)
  • definitions: MidnightBlue (RGB 25, 25, 112; #191970)
  • strings: DarkGreen (RGB 0, 100, 0; #006400)
  • normal text: Black
  • selected: Black [& DarkGray (RGB 169, 169, 169; #A9A9A9)]
  • found: LightGray (RGB 211, 211, 211; #D3D3D3) [& Black]
  • builtins: Indigo (RGB 75, 0, 130; #4B0082)
  • editor breakpoint: Black [& Khaki (RGB 240, 230, 140; #F0E68C)]
  • shell error: Black [& LightCoral (RGB 240, 128, 128; #F08080)]
  • cursor: Black
  • shell: SaddleBrown (RGB 139, 69, 19; #8B4513)
  • shell stdout: MidnightBlue (RGB 25, 25, 112; #191970)
  • stderr: FireBrick (RGB 178, 34, 34; #B22222)

I don’t use, f.lux, but they too have the right idea. I just changed the settings on my monitor to be slightly warmer so it’s permanently in that sort of mode - no need for a special program to do it. But to be fair, I don’t have to share my monitor, so that’s definitely a consideration.

9 Likes

yeah nowadays even windows have the option to slightly dim the light or make it more softer, so f.lux isnt a must for me like it was back in the day…

and yeah some of the colors they chose in the solarized light scheme are not that great… but for now im ok with it

7 Likes

A bit out of context… but your article is so interesting to read. Thumbs up!!!

4 Likes

I’m personally fond of peppermint and cyberpunk.

3 Likes

This is free for next 3 days…Read the comments …

And here is an Android app free with NO ads.

https://whatsonmypc.net/2019/08/19/eye-protector/

4 Likes

IDLE noice lol I use that usually or pycharm if it’s necessary for python related stuff.
f.flux is good but sunset screen is a good alternative.
But what has been important for me is reducing glare, my laptop actually lights up but i have that turned off because it is super irritating to the eyes, the light reflects onto the screen.

4 Likes

You clearly have better eyesight than I do!

4 Likes

f.lux is OK but it’s not Open Source.

Redshift, on the other hand, is Open Source and provides even more options. I’ve been using if for years – on Linux as well as Windows:

5 Likes

I think this is the most appropriate thread to post this kind of solution. Unfortunately just now I payed attention what the program actually does, while it was sitting in my mail box for 2 days or something :frowning:

Iris Pro (100% discount) | SharewareOnSale

11 hours left (unfortunately) as of time of posting.

It seems to be pretty decent with plenty of customization options, but haven’t tried it yet and I’m too keen to keep as true colors as possible except when I use the night light windows 10 function 'cuz it’s easier to activate than my Dell monitor color scheme options (just too lazy to set up shortcut key combination for them).

Hope this will be helpful to someone before the giveaway expires!

@delenn13 had already posted the giveaway of the Mini version, but this should have way more features.

3 Likes

Worth a look, thanks!

3 Likes