Although Microsoft Visio shares the basic theme structure with Microsoft Office, it had to be extended to suit the extra complexity required. Theming not only affects the color, but also the fonts, connectors and effects. The animated gif below flashes through all of the themes and variants available in the Visio 2013/2016 interface. These are not the only themes built-in because there are still some deprecated ones, and some legacy Visio themes.
The Visio Document object has a GetThemeNamesU() and a GetThemeNames() function to retrieve the list of available theme names (universal and local) in Visio. The first column in the table below shows the UI available themes in Visio, as these are the ones that are common to Microsoft Office.
UI available themes
Legacy Visio themes
*Notice that #38 is named Wisp. This is consistent with the themes in Microsoft Office, but the Visio UI lists it as Whisp in the UI currently, as does the page XML. Fortunately, the reference is made by the Id.
Each Visio Page can have a different theme applied to it, and one of four variants of the theme.
Once a main theme has been set, then each page can have a different theme set for Colors, Effects, Connectors and Fonts. In addition, the Embellishment can be set to Auto, Low, Medium or High. A variation can be applied to the Color ( variants 1 to 7) and style (Subtle, Refined, Balanced, Moderate, Focused, Intense ). The Page object has a GetTheme(…) method to retrieve the name of the page’s primary theme, color, connector, effect or font scheme. There is also a GetThemeVariant(…) method to retrieve the variant color and style index, and optionally the embellishment.
A shape in a page can then have a QuickStyle of a theme variant applied to it. The Visio user user selects an entry from a 7 colors x 6 effects matrix in a drop-down gallery. The selected indices is stored in the cells in the QuickStyle section. A Shape has a SetQuickStyle(…) method, but there is no GetQuickStyle(…) one. The developer will need to use the CellsSRC(…) method to get the values for each index.
The following document explains the structure of dynamic themes, as these are called : [MS-VSDX]: Visio Graphics Service VSDX File Format. Section 184.108.40.206 contains a conceptual overview of dynamic themes.
This document refers to the Office Open XML specification which can be found at http://www.iso.org/iso/home/store/catalogue_ics/catalogue_detail_ics.htm?csnumber=61750
A good reference to Office Open XML format can be found at http://www.officeopenxml.com/index.php
The Visio document shown above has the following package structure (displayed using the Open XML Package Editor add-in for Visual Studio 2015 ). Each definition for each theme used in the document is stored in a separate themen.xml file.
The pages.xml file stores the index of the theme, color scheme, effect scheme, connector scheme and font scheme, along with the variation color and style.
All of the out of the box Visio Styles inherit from one called Theme, which inherits its values from the page theme for its relevant section, as can be seen from the ShapeSheet displayed below.
A Visio document containing a page for each theme can be downloaded from https://1drv.ms/u/s!AqkzN8kb1lAznrIDE7twl3H9Nthh7Q. It contains a Master nam
ed Themer which can be used to display or change the theme and variant of a page. In fact, double-clicking it will step through each variant sequentially.
More information can be found at John Goldsmith’s blog: