We have developed a Visual Studio plug-in to our customer (
CloudShare). The plug-in is a tool window that enables managing CloudShare environments from within Visual Studio (
CloudShare on Visual Studio Gallery).
During the tests we've noticed that our tool window does not change colors when applying a different theme. Searching the web we only found out some references to how you can use resource keys from the Shell assembly like this one:
How can I find out when Visual Studio theme color changes?
To enable themes in your code you need to add reference to Shell assembly in your xaml:
xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.12.0"
After that you can use the colors in your xaml like this:
<Setter Property="Background" Value="{DynamicResource {x:Static vsfx:VsBrushes.MenuKey}}"/>
You can take a look at the
MSDN article that describes the VsBrushes class.
The problem was you cannot actually understand which resource key to use when you look at the VsBrushes class.
To make it easier to identify the colors we have developed a Visual Studio plug-in that shows the actual colors of each key for the selected theme. This helps you with identifying the key for the current theme and apply them to your xaml.
You can also filter the list using RGB values. Print screen and paste into Paint. In Paint use the "Colour Picker" tool to select the relevant color and then open the "Edit Colours" window to find our what are the RGB values. After that use the filter in the tool window to see the relevant keys.
Plug-in on CodePlex:
https://vsthemecolorsviewer.codeplex.com/.
Download on Visual Studio Gallery:
2012,
2013.
We hope you will this useful.