Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Most programmers have their own personal preferences for syntax-highlighting color schemes, but I've been wondering, has anyone ever done an actual scientific study on what the best color scheme would be? I imagine such a study would look at things like the readability of the code, whether the programmer's eyes are drawn to the most important parts, etc.

Perhaps this was already done for something like the default Visual Studio theme, but I'd like to know if there are any publicly available studies out there, and what they found.

share|improve this question
I don't think anyone has specifically studied syntax coloring schemes, but principles from other fields still carry over. For example, the color red tends to draw attention. – Maxpm Jul 6 '11 at 5:31
+1 I've been wondering the same or color schemes of applications and the OS actually. – stijn Jul 6 '11 at 7:20

3 Answers

up vote 6 down vote accepted

Specific color schemes cannot be objectively better than all other color schemes, their ranking would be individually subjective based on taste and cultural factors.

However, certain rules for readability / clarity, use in particular ambient light environments etc etc... are applicable, these would carry over from graphic design / typography, human computer interface and other related studies.

Ethan Schoonover's Solarized project is an interesting piece of work: http://ethanschoonover.com/solarized

share|improve this answer
awesome link, thanks for sharing – Dal Jul 6 '11 at 7:45

I don't think such studies exist. In practice, when a company creates a new IDE, the syntax highlighting color scheme is based on the existent schemes of other IDEs.

For example, the default Visual Studio theme has nothing new nor original. Blue color was used for keywords for years, including by old Ada IDEs. Same thing for green comments. Some colors were more or less "new", like teal for the names of classes, but you can easily understand the reason behind the choice of those colors: it would be reasonable to set a color which is not far from blue (since those are pretty much like reserved words: Int32 for .NET, int for C#, etc.), but it must stay a basic color, distinct from the already used blue.

Now, what about alternative schemes, like the popular light text on dark background? They are not created by a scientist who studied the subject for years and made some complicated calculus to obtain the exact perfect match. Instead, a developer creates a scheme which is readable for him. He shares it on a website, and it becomes popular. That's all the magic.

Last thing: are there readability rules? Not too much.

  • For most part, it's something subjective: you can't argue that a blue keyword is more readable than a purple keyword, because somebody would be able to reply than for him, on his monitor, purple keyword is much more readable than the blue one.

  • For another part, it's just logical. A black-and-white scheme would not be as readable as the default one. In the same manner, you can't set keywords to be light yellow and comments to be light gray (let's say #eee) on a white background, because it's unreadable, and you don't even have to explain why. Those are the same rules when making a website or printing a book or whatsoever.

share|improve this answer

Well, I guess the first question will be whether or not the white background is such a great idea. Just because it comes close to real paper and we can find everywhere on the Internet these days doesn't necessarily make it a good (or may I say perfect) choice.

I remember that (many many) years ago we only had the yellow-on-black "colour scheme". And I also remember that it wasn't that bad. It didn't have that contrast as black&white. Not too long ago I learned that it is also better to the human eye.

Sometimes I really wonder who designs the colour schemes that, e.g. get shipped with operating systems. I usually ignore them, but I remember seeing really awesome mixtures of pink and green and whatnot. Well, I don't do drugs...

There are some studies about what colours do to your subconsciousness (calm down, cause aggressions, ...). I'm thinking that the commonly used colour schemes are somewhat based on that. Maybe they just added readability. Coding shouldn't be a suicide mission.

But as far as the colour scheme of current IDEs is concerned I'm fine with it. Let's face it: the simple idea behind it is to make it easier to find something that's different from the general "code noise". And to be honest I don't really care what colours they use to allow that. It just shouldn't hurt my eyes or burn parts of the code into the back of my head, like a glaring red on some tone of green.

Coding should be relaxing. And that's what it is to me.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.