Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find out when Visual Studio theme color changes?

I develop the Visual Studio package with a tool window. The UI of the tool window is based on WPF. In my user control I want to use current Visual Studio theme colors corresponding to the VS design.

Therefore my question is how I can find out that Visual Studio theme color has been changed?

Thanks in advance.

like image 224
pingvinius Avatar asked Aug 29 '11 14:08

pingvinius


People also ask

How do I change the color of my Visual Studio theme?

Here's how to change it to a different color theme. On the menu bar, select Tools > Options. In the options list, select Environment > General. In the Color theme list, choose between the default Dark theme, the Blue theme, the Blue (Extra Contrast) theme, and the Light theme.

How do I find colors in Visual Studio?

Visual Studio themes Users are prompted to select a theme during their first use of Visual Studio and are able to switch themes later by going to Tools > Options > Environment > General and choosing a new theme from the "color theme" drop-down menu.

Which color theme is good for eyes in Visual Studio?

Dark (best colors for minimized eye strain)🌃 Neon ~ (for Cyberpunk Lovers) 😉 Sunset Red (Red is soothing for eyes and helps to sleep better) 🌇 Night Owl (inspired by Sarah Drasner's Night Owl Theme)🦉


2 Answers

I've found another way to do it. I can use visual studio theme colors resources from xaml directly. For example:

Background="{DynamicResource {x:Static vsfx:VsBrushes.ToolWindowBackgroundKey}}"

where vsfx is

xmlns:vsfx="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.10.0"

This approach solved this problem!

like image 77
pingvinius Avatar answered Oct 13 '22 21:10

pingvinius


If you want to detect the theme change event itself, you can make use of the VSColorTheme.ThemeChanged static event.

like image 42
Cameron Avatar answered Oct 13 '22 21:10

Cameron