With the release of Visual Studio 2015, I tried to import the color themes I used previously in VS 2013. To my surprise, they didn’t work correctly. After trying several themes available at Studio Styles, I realized that something changed in the latest incarnation of Microsoft’s IDE in the way it handled color (or named its attributes).
After doing some research over the internet, I found no mention to the problem. The available color themes at Studio Styles were up-to-date but apparently still weren’t 100% compatible and no one had new versions created specifically for this. What I did found was an extension for Visual Studio 2015 called Color Theme Editor.
That extension is a revamped and expanded alternative to customizing the editor via Tools > Options > Fonts and Colors. It has a (big) list of possible attributes with their associated color and a preview of how it looks like. It also features a Search box, which can be used to filter said list either by attribute name or even a specific color.
The tool works great until it doesn’t. The search box can become unstable from time to time (especially when searching for colors, from what I’ve tested) crashing the program in the process; also, there’s no guide whatsoever (beyond the name) on what each attributes represents. Luckily, each Visual Styles page contains examples of how code might look like with a particular theme and hovering on the different symbols revealed its corresponding attribute name. It wasn’t until a couple of days later that I found an article by Microsoft, titled Fonts and Colors, Environment, Options Dialog Box, that helped me understand better what most attributes represented.
While color themes for Visual Studio 2013 aren’t completely compatible with 2015, most of the colors are imported correctly, meaning that the heavy work was already done when I imported them. Some user types, however, were kept being displayed using VS’s default color scheme and not the color specified in the theme file.
Updating a VS2013 theme
The procedure to create a valid theme for VS2015, starting from an existing theme from VS2013, is the following:
- Download the desired theme from Visual Styles. Say, Son of Obsidian.
- It’s recommended to have any visual settings in Visual Studio set to their default. This can be accomplished by selecting Tools > Import and Export Settings > Reset all settings. Backing up the current settings is optional.
- Install the Color Theme Editor extension and open it via Tools > Customize Colors.
- Such editor already comes with several pre-installed themes. Pick one from your choice, the closer to the desired theme as possible, by clicking on the little icon on its corner, which reads Create Copy of Theme and resembles a paint palette.
- Assign a name to the new template: Son of Obsidian 2015, for example. Beware, this is the only point where names can be set; otherwise they can’t be modified. A workaround would be creating a copy of the theme, setting the new name and deleting the original theme.
- Activate the new theme by clicking on it.
- Use the aforementioned option (step #2), Import and Export Settings, to import the original color theme downloaded on Step 1.
- To modify the new theme, hover on its corner and click the second button (the paint palette with the pencil).
- The Color Theme editor has two possible modes, common elements and all elements, which is confusing as the so-called common elements are the attributes related to the IDE itself (and not the text content from open files). Select the Show All Elements button on the editor’s toolbar (the one with two columns).
- We need to import the options of the original theme. Click in the paint palette with the right arrow, the last element at the editor’s toolbar. Hopefully, the only colors that need to be updated (as far as I know) are the ones related to the User Types (e.g. classes, delegates, structures, etc. in C#). Their hex value should read FF4EC9B0, in case you’re used VS2015’s Dark theme as the base.
- The tricky and most tedious part of this process is selecting the new color. Opening the original theme’s file with a text editor and using the values presented there doesn’t seem to work. The solution, while inelegant, gets the job done: double-click on the desired color to change and use the provided color picker to snatch the desired color from the original theme’s website. It’s recommended to zoom-in as much as possible to be able to grab the correct color and not an in-between, result of text antialiasing.
- Repeat the process until done. The editor supports copy-paste shortcuts, as well as multiple attributes selection, making it easier than picking the same color every single time.
- When finished, click the second item in the toolbox (the check mark) to save changes and re-load the color theme to the IDE.
- Optionally, to export, click on the third icon (the paint palette with the right arrow).
Creating themes for Visual Studio can be tedious, it would be great if the editor provided some kind of wizard or step-by-step, guided tour.
They should work great for C# but may have wrong colors for other stuff (like C++); any discrepancies, please report them below in the comments.