hackification

Homepage

...rediscover the joy of coding

Designing a VS2010 Color Scheme - Consistency, Consistency, Consistency

I recently found StudioStyles, a collection of Visual Studio 2010 color schemes, and it inspired me to create my own. I've never bothered customizing my editor colors before, but since VS2010 has an overall darker look, I thought I'd have a bash at creating a matching dark editor scheme.

Looking through some of the submissions on the site, I was struck by how... well... random most of them are. Without meaning to be rude, they just look like someone went through the list, randomly assigning colors. Many many programmers believe coding and graphic design are polar opposites - that if you're a coder, you must necessarily suffer from "programmer art", and hence that it's pointless to ever try to learn better design skills. I completely disagree with this diagnosis.

I'm going to use only one design rule for this color scheme - consistency: keep similar things similar, and make different things different.

Basics

I've already decided to create a "dark" theme, so the background will be black. I also want to highlight important or dangerous elements of the source, and downplay incidental aspects. This idea will modify each of the colors chosen, and help suggest colors where there is no clear choice. Each choice will be reflected as far as is possible across many file types - for example, a C# comment should probably be the same color as an XML one, a JavaScript one, etc.

I'm also going to make use of color shades. I know Visual Studio has to cater for people using low-color displays, remote desktop, and those with reduced vision, but its use of primary colors leaves it looking a little dated. Color shades can be used to bring the look a little more up-to-date, and to group related elements, while still being able to distinguish between them.

Comments - Green

Comments have always been green in Visual Studio, and I'm going to keep them that way - a vibrant green, made bold, to catch the eye. (If comments aren't important, then why are you writing them?) Comment hyperlinks and the text in #region blocks also match.

Literals - Blue

String literals are red in the standard Visual Studio color scheme, but I wanted to reserve that color for errors and the like. In my mind strings are blue (don't ask me why) so I've chosen a light blue for strings.

With consistency in mind, what else should match this?

Keywords - Gray

Since the background is black, 'unadorned' text will be white - a nice easy choice. How about keywords?

I want to make them a different color - so I can tell when I've typed 'retrun' for the billionth time - but I don't consider them to be "core" code. I think of them as scaffolding around my identifiers. (Perhaps I'm a LISPer at heart). I've chosen to keep them a neutral color, but a dimmer shade, so they fade out - hence gray.

Types - Yellow/Orange

Colorizing types is handy as it again allows me to see when I've mis-typed something. I want them to stand out (so a dim color is out), and I don't want them confused with anything else - so reds, greens, and blues are gone. Yellows and light oranges seem a good choice - close enough to the normal white text, but sufficiently different to catch the eye. I've chosen a light orange for types, and highlighted interface types as yellow. (I figure that looking at how interfaces are defined and used is often a good way to understand the structure of a body of code - hence the slightly more eye-catching color).

(Oddly enough, this doesn't seem to work for types in C++ - they always seem to come out white. Not sure why.)

Errors, Warnings, and Oddities - Red

This was an easy color to choose - red (for me) means stop and think. There are a few code constructs that I wanted to highlight as either dangerous or needing attention:

Editor Overlays - Purple/Dark Blue

Visual Studio now highlights parts of the source depending on where youyr cursor is - it highlights matching braces, and will also display all usages of the symbol at the caret. These display can change rapidly, so shouldn't be too distracting. I've chosen a dark purple, which is subtly visible, but which blends in with the black background.

We need a related color for the selection too, so I've chosen dark blue.

Omissions

There's still quite a few entries in the colors list I haven't filled out - the main areas being: If you fancy addressing these omissions and sending me back an updated settings file, I'll be happy to credit you.

Conclusion & Download

So there you go. Obviously color schemes are very personal (and contentious). I think I've done a pretty good job; you might well think otherwise. Even if you don't like this particular scheme, I hope you'll agree that setting a few design principles in place before assigning colors can help you choose (and use) the colors effectively.

Sadly there's no way to upload my settings to StudioStyles, and I'm too lazy to re-do all the work by hand. Until they allow that option, I'll host the settings from here:
Download hackification.vssettings
Save this file somewhere, then use Tools -> Import and Export Settings... to merge them in.