How to customize color settings for Code Coverage Result in Visual Studio ?

How to customize color settings for Code Coverage Result in Visual Studio ?

This question came up after one of our previous post – Understanding Code Coverage – How to determine which portion of code is being tested in Visual Studio ? .  We discussed about different colors of code coverage area and how it looks like when the code is covered, not covered or partially covered.  For few, the colors were different than what we have seen over the other post,  so the question was, can we customize the code coverage colors ? Yes. We can do it.

Here is the default color for the different set of code coverage block.

Default Coloring of Code Coverage
Default Coloring of Code Coverage

To change color, or customize the style, you need to open Options Dialog window, from Tools –> Options.  Then search for “Fonts and Colors” option in the right side tree explorer.  Once Fonts and Colors is selected, search for “Coverage… “ under Display Items. You will find following three Display items

  • Coverage Not Touched Area
  • Coverage Partially Touched Area
  • Coverage Touched Area

Related Post : Search within Options Dialog Control – Visual Studio

Code Coverage Options
Code Coverage Options

Now, you can change the default color, fonts and styles for the individual items.

Code Coverage Settings Change
Code Coverage Settings Change

Here is one example of different set of code coverage colors.

Customize Code Coverage Color
Customize Code Coverage Color

 

Hope this helps.

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

3 Comments to “How to customize color settings for Code Coverage Result in Visual Studio ?”

Comments are closed.