Tim Tim - 1 month ago 28
C# Question

Get Visio theme color

In Visio you can set the theme of your Visio

File > Options > General > Office Theme
. I would like to retrieve this value in my addin in visual studio so that I can adjust my own custom windows. However I can not find this setting. Can somebody tell me where I can find it or how I can access it?

Answer

You can read the value of the DWORD registry key UI Theme which can be found under:

HKEY_CURRENT_USER\Software\Microsoft\Office\1x.0\Common

Replace the 1x.0 with your Office version number which is currently 15.0 for Office 2013 or 16.0 for Office 2016.

The possible values for Office 2013 are:

  • 0 White
  • 1 Light Grey
  • 2 Dark Grey

The possible values for Office 2016 are:

  • 0 Colorful
  • 3 Dark Grey
  • 4 Black (not available in all versions)
  • 5 White

It's also possible to listen for theme changes using ManagementEventWatcher.EventArrived like shown here: Receive notification when RegistryKey Value was changed