• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

bVisual

  • Home
  • Services
    • How Visio smartness can help your business
    • Visio visual in Power BI
    • Visio Consulting Services
    • Visio Bureau Services
    • Visio Training and Support Services
  • Products
    • Visio Shape Report Converter
    • SS Plus
    • LayerManager
    • visViewer
    • Metro Icons
    • Rules Tools for Visio
    • The Visio 2010 Sessions App
    • Multi-Language Text for Visio
    • Document Imager for Visio
    • multiSelect for Visio
    • pdSelect for Visio
  • Case Studies
    • Case studies overview
    • Using Visio in Education for GIS
    • Visualizing Construction Project Schedules
    • Visio Online Business Process Mapping
    • Nexans Visio Template
    • CNEE Projects, WorldCom
    • Chase Manhattan Bank
  • News
    • Recent news
    • News archive
  • Resources
    • Articles➡
      • ShapeSheet Functions A-Z
      • Comparing Visio for the Web and Desktop
      • Customising Visio Shapes for the Web App
      • Key differences between the Visio desktop and web apps
      • Using the Visio Data Visualizer in Excel
      • Using Visio in Teams
      • Creating Visio Tabs and Apps for Teams with SharePoint Framework (SPFx)
      • Designing Power Automate Flows with Microsoft Visio
      • Innovative uses of Visio Lists
    • Webcasts ➡
      • Visio in Organizations
      • My session and other Visio sessions at MSIgnite 2019
      • Power up your Visio diagrams
      • Vision up your Visio diagrams
      • The Visio 2010 MVP Sessions
    • Visio Web Learning Resources
    • Books➡
      • Visualize Complex Processes with Microsoft Visio
      • Mastering Data Visualization with Microsoft Visio
      • Microsoft Visio Business Process Diagramming and Validation
      • Visualizing Information with Microsoft Visio
  • Blog
    • Browse blog articles
    • Visio Power BI articles
    • Visio for Web articles
    • A history of messaging and encryption
  • About us
    • About bVisual
    • Testimonials
    • Bio of David Parker
    • Contact Us
    • Website Privacy Policy
    • Website terms and conditions
    • Ariba Network
You are here: Home / Visio / Visio for Desktop / Getting the Microsoft Office Theme Value

Published on July 24, 2020 by David Parker

Getting the Microsoft Office Theme Value

I am working on a Visio VSTO project where I need to synchronise a UI element with the current session Microsoft Office Theme. At first, I thought that there would be some way of getting a value from the Visio object model, but I was wrong…

The Office Theme can be selected from either the Visio Options, or the Account Options panels.

  • Visio Options
  • Account Options

As can be seen in the following slideshow, the Office Theme selected has a drastic effect on the Visio UI:

  • Office Theme : Colorful
  • Office Theme : Dark Gray
  • Office Theme : Black
  • Office Theme : White

The Visio object model does have an ApplicationSettings object that has many settings that used to provide the color values of the Visio UI elements for the current session, but my tests show that these always return the same values, regardless of the Office Theme selected.

There also used to be user interface to edit these, but now, I guess, they are no longer used….

The Registry does have a number of the Visio UI elements, but not the particular ones that I am interested, such as the Drawing Background.

So, I searched the web for more insight into how I might be able to get the Office Theme colors, but the best I could find was https://stackoverflow.com/questions/60078708/is-it-possible-to-get-the-current-office-design-via-c-sharp-in-vsto-add-in . So, basically, it is possible to get the Office Theme number from the registry, but not the RGB values (unless someone knows different!).

I adapted the code in the link from the above article to read the Registry:

private static int OfficeThemeValue(string officeVersion)
{
	int uiThemeValue = 0;
	string OfficeCommonKey = $@"Software\Microsoft\Office\{officeVersion}\Common";
	RegistryKey regKey = Registry.CurrentUser.OpenSubKey(OfficeCommonKey, false);
	var subValues = regKey.GetValueNames().ToList();
	if (subValues.Contains("UI Theme"))
	{
		uiThemeValue = Convert.ToInt32(regKey.GetValue("UI Theme"));
	}

	return uiThemeValue;
}

All I need now is the Visio version number, which is available from the Application.Version property, and pas that through to the above method.

Surprisingly, the return values are:

  • 0 – Colorful
  • 3 – Dark Gray
  • 4 – Black
  • 5 – White

I think that 1 and 2 where Blue and Silver in earlier versions of Office.

So, now I just had to sample the RGB values of the Drawing Background for each one:

  • Colorful – RGB(235,235,235)
  • Dark Gray – RGB(102,102,102)
  • Black – RGB(38,38,38)
  • White – RGB(255,255,255)

Now, I can add these values to my code to make the changes to the UI that I want….

Related

Filed Under: C#, Shape Design, TimeTable, Uncategorized, Visio, Visio for Desktop Tagged With: Shape Design, Visio

About David Parker

David Parker has 25 years' experience of providing data visualization solutions to companies around the globe. He is a Microsoft MVP and Visio expert.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

  • LinkedIn
  • Twitter

Recent Posts

  • Fixing dimensions of 2D shapes
  • Merging Linked Data from Similar Tables
  • Smart Radio Buttons and Check Boxes in Visio
  • Using Button Face Ids in Visio
  • Grid Snapping Revisited

Categories

Tags

Accessibility Add-Ins Connectors Containers Data Export Data Graphics Data Import Data Visualizer Educational Excel GraphDatabase Hyperlinks Icon Sets JavaScript LayerManager Layers Legend Link Data to Shapes Lists MSIgnite MVP Office365 Org Chart PowerApps PowerBI PowerQuery Processes Setup and Deployment Shape Data Shape Design ShapeSheet ShapeSheet Functions SharePoint 2013 SQL Teams Validation VBA Video Visio Visio 2007 Visio for the Web Visio Online Visio Services Visio Viewer Webinar

Footer

bVisual Profile

The UK-based independent Visio consultancy with a worldwide reach. We have over 25 years experience of providing data visualization solutions to companies around the globe.

Learn more about bVisual

  • Amazon
  • E-mail
  • Facebook
  • LinkedIn
  • Twitter
  • YouTube

Search this website

Recent posts

  • Fixing dimensions of 2D shapes
  • Merging Linked Data from Similar Tables
  • Smart Radio Buttons and Check Boxes in Visio
  • Using Button Face Ids in Visio
  • Grid Snapping Revisited

Copyright © 2025 · Executive Pro on Genesis Framework · WordPress · Log in