How To Add Awesome Monokai Colors For Beautiful C# Development in Visual Studio 2017 For Windows

You’ve finally come to the right place! It IS Possible!

Chris Frewin
8 min readOct 5, 2018

^ How a part of a SHA-3 implementation in C# looks in Visual Studio after following this tutorial.

Finally.

Ah… finally! If you’ve spent a while trying to find how to get Monokai syntax highlighting in Visual Studio 2017, you’ve come to the right place!

This took me a few days to figure out, and with no step-by-step tutorial to be found (partially WHY it took me a few days to figure out), I made this in-depth how-to for all you Monokai lovers out there.

***Update January 10th, 2019: To save a BUNCH of time, you can get the vssettings corresponding to this tutorial at this repository!

***Note that this tutorial is NOT for Visual Studio CODE, the editor! This tutorial is for Visual Studio, the IDE.

***Also note that this tutorial is for Windows. In the Xamarin version for Mac, Monokai is a built-in in the menu Visual Studio Community (the version I have 😃) →Preferences… →Text Editor →Color Theme →Monokai →OK:

Menus for Monokai Color Theme on Visual Studio for Mac.

(I also set my theme to ‘Dark’ on my Mac, under the menu Visual Studio Community →Preferences… →Visual Style →Dark)

Background: I ❤️ Monokai

NOT Monokai ‘Dark’, NOT Panda, NOT Sublime Material! Argh! This is all the stuff I ran into while trying to add Monokai-like syntax highlighting.

We’re gonna implement pure original Monokai syntax highlighting sweetness, with the colors as used in Ace Editor:

A little teaser image of what your C# code will look like in Visual Studio if you follow this tutorial! (Ignore my nooby C# code!)

I may be a bit obsessive about this, but with any new editor, I always feel the need to add the Monokai syntax highlighting. This has been the case ever since I used good ol’ Sublime text. It sounds corny, but to me, programming never feels quite right with Monokai. Heck, I even themed my blog with monokai colors!

(See this GitHub repository as an example of my obsession. I wrote a Greasemonkey Script that changes the Ace Editor used in SAP’s Web IDE after loading to Monokai.)

So, let’s get started. This miraculously worked out to be a typical 1–2–3 step process!

Step 1: Set Visual Studio Color Theme to ‘Dark’

This is more of a prerequisite than a step, but I strongly recommend you first set your Visual Studio Color Theme to ‘Dark’. That is under Tools →Change Color Theme →Dark:

How to set the Visual Studio theme to ‘Dark’.

But, if you want the rest of the IDE to be with a different color theme, you can keep it if you wish. This tutorial will get as far as the line numbers and sidebar colors in the text editor, but won’t change colors for anything outside the text editor. I just think any theme outside of ‘Dark’ will probably end up looking weird 😜.

Step 2: Install The Enhanced Syntax Highlighting Tool

To apply all the colors from Monokai properly, we will need the Enhanced Syntax Highlighting tool by Stanislav Kuzmich.

So, quit Visual Studio, install that tool, and start up Visual Studio again.

Step 3: Modify the Necessary Colors

This is the annoying and time-consuming bit. We need to go into the ‘Fonts and Colors’ menu in Visual Studio and change each part of the syntax part by part.

As far as I know, there is no way to do this with an automated process. 😒

Instead, I will give you the key-value pairs of ‘User Tags’ and ‘User Types’, in the same order as they show up in the ‘Fonts and Colors’ menu!

First, go to Tools →Options:

Navigation path for ‘Options’.

Then in the popup, Environment →Fonts and Colors:

Display Item and Foreground / Background Values

I’ll use bold, italics, and a series of hyphens and commas to easily designate which values need to be filled.

Example:

Display Item: Item foreground or Item background-red value, green value, blue value (resulting color)

Actual Values for C# Monokai Syntax Highlighting:

Plain Text: Item foreground-248,248,242 (off-white)

Plain Text: Item background-39,40,34 (off-black)

Selected Text: Item background-85,84,70 (dark gray)

Line Number: Item foreground-143,144,138 (gray)

Line Number: Item background-47,49,41 (off-black, slightly lighter than standard background)

Note that the rest of the values are all ‘Item foreground’:

Keyword: Item foreground-249,38,114 (Monokai magenta)

Number: Item foreground-174,129,255 (Monokai purple)

Operator: Item foreground-249,38,114 (Monokai magenta)

String: Item foreground-230,219,116 (Monokai yellow)

String -Verbatim: Item foreground-230,219,116 (Monokai yellow)

User Tags — Events: Item foreground-102,217,239 (Monokai blue)

User Tags — Fields: Item foreground-102,217,239 (Monokai blue)

User Tags — Fields (Constant): Item foreground-102,217,239 (Monokai blue)

User Tags — Fields (Inside Enums): Item foreground-102,217,239 (Monokai blue)

User Tags — Local Variables: Item foreground-248,248,242 (off-white)

User Tags — Methods: Item foreground-166,226,46 (Monokai green)

User Tags — Methods (Extension): Item foreground-166,226,46 (Monokai green)

User Tags — Methods (Static): Item foreground-166,226,46 (Monokai green)

User Tags — Namespaces: Item foreground-248,248,242 (off-white)

User Tags — Parameters: Item foreground-253,151,31 (Monokai orange)

User Tags — Properties: Item foreground-102,217,239 (Monokai blue)

User Types — Classes: Item foreground-102,217,239 (Monokai blue)

User Types — Delegates: Item foreground-102,217,239 (Monokai blue)

User Types —Enums: Item foreground-174,129,255 (Monokai purple)

User Types — Interfaces: Item foreground-174,129,255 (Monokai purple)

User Types —Modules: Item foreground-166,226,46 (Monokai green)

User Types — Structures: Item foreground-166,226,46 (Monokai green)

User Types — Type Parameters: Item foreground-166,226,46 (Monokai green)

Final Notes and Further Options / Customizing

I have no idea how this looks on other languages like C++ and F#, since I haven’t used them yet in Visual Studio. I’m focusing on native and ASP.NET core development with C#.

Additionally, you may want to change the colors of the different ‘User Tags’ and ‘User Types’ (Ex. do you want your static and non-static methods to both be green?)

Those are questions I’ll leave to you to answer, but the info I’ve provided is the minimalist implementation.

Another important note: I have made but one change to the original Ace Monokai them, and that was the highlighting color. I found it simply too dark in the Visual Studio environment somehow. I could hardly see what code I was selecting. If you wish to leave the highlighting color with the original value, then the value (‘Item background’) is:

Selected Text: Item background: 73,72,62 (quite dark gray)

VSSettings File

Michael Armes was kind enough to leave a link in the comments to a repository with the vssettings file(which I failed to think of in the first place 😃) Thanks, Michael! The contents of that file are here:

<UserSettings>
<ApplicationIdentity version="15.0"/>
<ToolsOptions>
<ToolsOptionsCategory name="Environment" RegisteredName="Environment"/>
</ToolsOptions>
<Category name="Environment_Group" RegisteredName="Environment_Group">
<Category name="Environment_FontsAndColors" Category="{1EDA5DD4-927A-43a7-810E-7FD247D0DA1D}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_FontsAndColors" PackageName="Visual Studio Environment Package">
<PropertyValue name="Version">2</PropertyValue>
<FontsAndColors Version="2.0">
<Theme Id="{1DED0138-47CE-435E-84EF-9EC1F439B749}"/>
<Categories>
<Category GUID="{FF349800-EA43-46C1-8C98-878E78F46501}" FontName="Envy Code R" FontSize="10" CharSet="1" FontIsDefault="No">
<Items>
<Item Name="Breakpoint (Enabled)" Foreground="0x00FFFFFF" Background="0x004D25F9" BoldFont="No"/>
<Item Name="Current Statement" Foreground="0x00000000" Background="0x000FE2F5" BoldFont="No"/>
</Items>
</Category>
<Category GUID="{58E96763-1D3B-4E05-B6BA-FF7115FD0B7B}" FontName="Envy Code R" FontSize="10" CharSet="1" FontIsDefault="No">
<Items>
<Item Name="Indicator Margin" Foreground="0x02000000" Background="0x00333333" BoldFont="No"/>
<Item Name="Inactive Selected Text" Foreground="0x02000000" Background="0x00565656" BoldFont="No"/>
<Item Name="Selected Text" Foreground="0x02000000" Background="0x00465455" BoldFont="No"/>
<Item Name="Plain Text" Foreground="0x00F2F8F8" Background="0x00222827" BoldFont="No"/>
</Items>
</Category>
<Category GUID="{FA937F7B-C0D2-46B8-9F10-A7A92642B384}" FontIsDefault="Yes">
<Items>
<Item Name="Artboard Background" Foreground="0x02000000" Background="0x02000000"/>
</Items>
</Category>
<Category GUID="{B36B0228-DBAD-4DB0-B9C7-2AD3E572010F}" FontName="Segoe UI" FontSize="9" CharSet="1" FontIsDefault="No">
<Items>
<Item Name="Odd Row Items" Foreground="0x00000000" Background="0x00FFFFFF" BoldFont="No"/>
<Item Name="Even Row Items" Foreground="0x00000000" Background="0x00FFFFFF" BoldFont="No"/>
<Item Name="Not Downloaded" Foreground="0x00999999" Background="0x00FFFFFF" BoldFont="No"/>
<Item Name="Target Only" Foreground="0x00000000" Background="0x00FFFFFF" BoldFont="No"/>
<Item Name="Source Only" Foreground="0x00000000" Background="0x00FFFFFF" BoldFont="No"/>
<Item Name="Identical content" Foreground="0x00000000" Background="0x00FFFFFF" BoldFont="No"/>
<Item Name="Different content" Foreground="0x000014E5" Background="0x00FFFFFF" BoldFont="No"/>
</Items>
</Category>
<Category GUID="{E0187991-B458-4F7E-8CA9-42C9A573B56C}" FontName="Envy Code R" FontSize="10" CharSet="1" FontIsDefault="No">
<Items>
<Item Name="XML Attribute Quotes" Foreground="0x005CC2CC" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Attribute Value" Foreground="0x005CC2CC" Background="0x02000000" BoldFont="No"/>
<Item Name="XML CData Section" Foreground="0x00808080" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Attribute" Foreground="0x00969696" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Name" Foreground="0x001E86FD" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Comment" Foreground="0x0058544D" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Delimiter" Foreground="0x0058544D" Background="0x02000000" BoldFont="No"/>
<Item Name="XML Text" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Markup Extension Parameter Value" Foreground="0x002EE2A6" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Markup Extension Parameter Name" Foreground="0x00FFFFFF" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Markup Extension Class" Foreground="0x00EFC045" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Attribute Quotes" Foreground="0x00000000" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Attribute Value" Foreground="0x005CC2CC" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML CData Section" Foreground="0x00808080" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Attribute" Foreground="0x00969696" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Name" Foreground="0x001E86FD" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Comment" Foreground="0x0058544D" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Delimiter" Foreground="0x0058544D" Background="0x02000000" BoldFont="No"/>
<Item Name="XAML Text" Foreground="0x02000000" Background="0x02000000" BoldFont="No"/>
<Item Name="Number" Foreground="0x00FF81AE" Background="0x02000000" BoldFont="No"/>
<Item Name="String" Foreground="0x0074DBE6" Background="0x02000000" BoldFont="No"/>
<Item Name="Comment" Foreground="0x0000CA00" Background="0x02000000" BoldFont="No"/>
<Item Name="Keyword" Foreground="0x007226F9" Background="0x02000000" BoldFont="No"/>
</Items>
</Category>
<Category GUID="{75A05685-00A8-4DED-BAE5-E7A50BFA929A}" FontName="Envy Code R" FontSize="10" CharSet="1" FontIsDefault="No">
<Items>
<Item Name="deltadiff.remove.word" Foreground="0x006666FF" Background="0x0000009D" BoldFont="No"/>
<Item Name="Selected Text" Foreground="0x02000000" Background="0x00465455" BoldFont="No"/>
<Item Name="urlformat" Foreground="0x0009F1B5" Background="0x02000000" BoldFont="No"/>
<Item Name="CurrentLineActiveFormat" Foreground="0x00F2EAEA" Background="0x00000000" BoldFont="No"/>
<Item Name="Selected Text in High Contrast" Foreground="0x00C0C0C0" Background="0x01000001" BoldFont="No"/>
<Item Name="outlining.square" Foreground="0x002EE2A6" Background="0x001E1D1B" BoldFont="No"/>
<Item Name="outlining.verticalrule" Foreground="0x0058544D" Background="0x02000000" BoldFont="No"/>
<Item Name="outlining.collapsehintadornment" Foreground="0x00E8DDD7" Background="0x001E1D1B" BoldFont="No"/>
<Item Name="Line Number" Foreground="0x008A908F" Background="0x0029312F" BoldFont="No"/>
<Item Name="Number" Foreground="0x00FF81AE" Background="0x02000000" BoldFont="No"/>
<Item Name="String" Foreground="0x0074DBE6" Background="0x02000000" BoldFont="No"/>
<Item Name="Operator" Foreground="0x007226F9" Background="0x02000000" BoldFont="No"/>
<Item Name="Preprocessor Keyword" Foreground="0x006458FF" Background="0x02000000" BoldFont="No"/>
<Item Name="Keyword" Foreground="0x007226F9" Background="0x02000000" BoldFont="No"/>
<Item Name="Excluded Code" Foreground="0x0058544D" Background="0x02000000" BoldFont="No"/>
<Item Name="Comment" Foreground="0x0000CA00" Background="0x02000000" BoldFont="No"/>
<Item Name="brace matching" Foreground="0x02000000" Background="0x00303030" BoldFont="No"/>
<Item Name="xml doc comment - text" Foreground="0x00969696" Background="0x02000000" BoldFont="No"/>
<Item Name="type parameter name" Foreground="0x002EE2A6" Background="0x02000000" BoldFont="No"/>
<Item Name="struct name" Foreground="0x002EE2A6" Background="0x02000000" BoldFont="No"/>
<Item Name="module name" Foreground="0x002EE2A6" Background="0x02000000" BoldFont="No"/>
<Item Name="interface name" Foreground="0x00FF81AE" Background="0x02000000" BoldFont="No"/>
<Item Name="enum name" Foreground="0x00FF81AE" Background="0x02000000" BoldFont="No"/>
<Item Name="delegate name" Foreground="0x00EFD966" Background="0x02000000" BoldFont="No"/>
<Item Name="class name" Foreground="0x00EFD966" Background="0x02000000" BoldFont="No"/>
<Item Name="string - verbatim" Foreground="0x0074DBE6" Background="0x02000000" BoldFont="No"/>
<Item Name="RoslynActiveStatementTag" Foreground="0x02000000" Background="0x00000000" BoldFont="No"/>
<Item Name="HTML Tag Delimiter" Foreground="0x0058544D" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Server-Side Script" Foreground="0x006458FF" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Operator" Foreground="0x0058544D" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Entity" Foreground="0x00FF81AE" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Element Name" Foreground="0x001E86FD" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Comment" Foreground="0x0058544D" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Attribute Value" Foreground="0x005CC2CC" Background="0x02000000" BoldFont="No"/>
<Item Name="HTML Attribute" Foreground="0x00969696" Background="0x02000000" BoldFont="No"/>
<Item Name="RazorCode" Foreground="0x02000000" Background="0x00312223" BoldFont="No"/>
<Item Name="CSS String Value" Foreground="0x00FFFFFF" Background="0x02000000" BoldFont="No"/>
<Item Name="CSS Property Value" Foreground="0x00FF81AE" Background="0x02000000" BoldFont="No"/>
<Item Name="CSS Property Name" Foreground="0x0009F1B5" Background="0x02000000" BoldFont="No"/>
<Item Name="CSS Selector" Foreground="0x00EFC045" Background="0x02000000" BoldFont="No"/>
<Item Name="CSS Keyword" Foreground="0x004D25F9" Background="0x02000000" BoldFont="No"/>
<Item Name="CSS Comment" Foreground="0x0058544D" Background="0x02000000" BoldFont="No"/>
<Item Name="ASD-ESH.Definition.Property" Foreground="0x00EFD966" Background="0x01000001" BoldFont="No"/>
<Item Name="ASD-ESH.Definition.Parameter" Foreground="0x001F97FD" Background="0x01000001" BoldFont="No"/>
<Item Name="ASD-ESH.Definition.MethodStatic" Foreground="0x00FF80FF" Background="0x01000001" BoldFont="No"/>
<Item Name="ASD-ESH.Definition.MethodExtension" Foreground="0x002EE2A6" Background="0x01000001" BoldFont="No"/>
<Item Name="ASD-ESH.Definition.Method" Foreground="0x002EE2A6" Background="0x01000001" BoldFont="No"/>
<Item Name="ASD-ESH.Definition.Local" Foreground="0x00F2F8F8" Background="0x01000001" BoldFont="No"/>
<Item Name="ASD-ESH.Definition.Enum" Foreground="0x00EFD966" Background="0x01000001" BoldFont="No"/>
<Item Name="ASD-ESH.Definition.FieldConstant" Foreground="0x00EFD966" Background="0x01000001" BoldFont="No"/>
<Item Name="ASD-ESH.Definition.Field" Foreground="0x00EFD966" Background="0x01000001" BoldFont="No"/>
<Item Name="ASD-ESH.Definition.Event" Foreground="0x00EFD966" Background="0x01000001" BoldFont="No"/>
</Items>
</Category>
</Categories>
</FontsAndColors>
</Category>
</Category>
</UserSettings>

Thanks!

I hope you enjoyed that quick tutorial and can now sleep easy knowing you can still write C# in Visual Studio with the Monokai color scheme! 😄

Tutorials like these with all the screenshots and used values take a lot to write, and a clap or two gives me the motivation to write more of them!

-Chris

--

--

Chris Frewin

https://option-screener.com https://wheelscreener.com https://chrisfrew.in 👨‍💻 Full Stack Software Engineer 🏠 Austria/USA 🍺 Homebrewer ⛷🏃‍ 🚴 Outdoorsman