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.
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
Now, you can change the default color, fonts and styles for the individual items.
Here is one example of different set of code coverage colors.
Hope this helps.