ColorSchemeIndex = 0 is application of themes completely turned off on shape?

Started by Visisthebest, February 09, 2023, 01:02:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wapperdude

@Visisthebest: Yep.  I understand and understood.  My remark was to confirm that I did not have to do your extra step.  For me, the variation in this behavior for the various responders is very strange.  Historically, the performance has been more like what Surrogate and Croc observe.  I'm surprised it mostly works for you.  The concern is how reliable is this approach?  It strikes me as being less than robust.  At this point, I'd say, "User beware!"
Visio 2019 Pro

Croc

QuoteThe search for anti-theme teflon settings continues, in the mean time happy with the understanding how to remove theme application off a shape, even if it may be very hard / impossible to prevent a user from reapplying a theme.
...prevent a user from reapplying a theme?
I think you can try to hide the theme buttons from the user. No button - no themes :)
Of course this is not a 100% solution, but it should make reapplying a theme more difficult.
Look at this VBS script
UIFile = "C:\Work\RibTheme\NoTheme.xml"
VisFile = "C:\Work\RibTheme\NoTheme.vstx"
'
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile(UIFile,1)
xml = file.ReadAll
file.Close
Set app = CreateObject("Visio.InvisibleApp")
Set doc = app.Documents.Open(VisFile)
doc.CustomUI = xml
doc.Save
app.Quit
and such XML
<mso:customUI xmlns:mso="http://schemas.microsoft.com/office/2009/07/customui">
<mso:ribbon>
<mso:tabs>
<mso:tab idQ="mso:TabDesignVisio">
<mso:group idQ="mso:GroupThemesVisio"
           visible="false"/>
<mso:group idQ="mso:GroupThemeVariants"
           visible="false"/>
</mso:tab>
</mso:tabs>
</mso:ribbon>
</mso:customUI>

This script will remove GroupThemes and GroupThemeVariants from the Visio template. After that, all documents based on this template will not have buttons for changing themes.
A similar effect can be obtained through the Visio Options / Customize Ribbon menu. But then the effect will apply to all Visio drawings. In contrast, the above script only acts on the given template or the given document.

wapperdude

As with all things associated with themes, there are a couple of gotchas.

Merely saving a file with Themes removed from Ribbon will note pass along that inheritance.  Removing Themes from the Ribbon using embedded code is intrusive to other user systems.  Restoring Themes to Ribbon via standard interface, subsequently makes them a customization NOT identical to the original default configuration.

The Ribbon approach seems more ideally suited for personal use, and undesirable as a distributed feature.
Visio 2019 Pro