OOXML Hacking: Color Themes

This article presents some new ways to use color themes. To find out more about how color themes work in PowerPoint and other Office programs, please read this companion article as well: Great Color Themes – Brandwares Best Practices.

The simplest way to give a presentation variety through different topics is to apply new color themes. If you ever worked with pre-2007 versions of PowerPoint, you may remember that you could have unlimited numbers of Color Schemes (as they were called), that you could easily apply to groups of slides to give them visual cohesion with one another.

With the 2007 XML version of Office, that simplicity went away. Instead, a master slide could have only 1 Color Theme. Applying a Color Theme to a single slide now applies it to the master and every slide based on that master. For most presentations, it’s all or nothing with new colors. Fortunately, I figured out a workaround that brings back much of the color flexibility of earlier versions. Vari-colored sections are back!

There’s still a limit of 1 theme per master, so now we have to create additional master for every different theme we want to use. Typically these themes will be closely related, with only 1 or 2 colors varying per theme. Sometimes the colors stay the same, but only change position in the theme. I’ll get into how you use that later.

This screen shot shows the Master Slide (the larger one at top) followed by its Slide Layouts below. To add more Color Themes, we begin by copying the Master Slide. The copies of the Master don’t have to duplicate all the slide masters. If different colors are only needed for a chart, we’ll just attach one chart slide layout to the new master slide.

Then we create new color themes, attaching one to each master. After this, you could save the template and make a perfectly good presentation. To get the different color theme, you reapply layouts from different masters and the colors come along for the ride. However, it’s a non-intuitive way to apply colors. To create a better user interface, we need to hack some XML!

3 Slide Masters

3 Slide Masters in 1 presentation, showing the color theme attached to each.

To begin, review the instructions in my previous post about opening Office files in a text editor. If you’re editing in OS X, there are operating system issues you need to watch out for. I cover them in XML Hacking: Editing in OS X. The files we’re going to modify are in the ppt>theme folder. When open it, you see 4 files:

4 Themes

A presentation with 3 masters always has 4 themes, unless you take precautions.

By default, PowerPoint always saves its Office themes as the last in the list. The way around this is to create a new, blank presentation, then create color and font themes before saving for the first time. If you save first, the default Office color and font themes will be saved into your template in last place. You can always ignore the last file in the themes folder. We’re only going to edit the first 3. When you open up Theme1.xml and expand it to readable form, the first part of the theme looks like this:

Theme Listing

Theme names that appear in PowerPoint, plus the color associations.

The editing were’ going to do occurs at the bottom of each theme, so let’s scroll down. The screen cap below shows the end of an unedited theme. The part we’re going to expand is the extraClrSchemeLst stub.

New Theme Listing

First we split <a:extraClrSchemeLst/> into opening and closing tags: <a:extraClrSchemeLst> and </a:extraClrSchemeLst>. Then we can insert color themes between them. When we’re editing the Custom theme that is applied to slides by default, we can color themes for the other themes 2 and 3. Here’s the first extra color theme: I just opened theme2.xml to get the values for this.

Color Theme 2

The first Extra theme takes values from theme2.xml.

Then add the color scheme from theme3.xml and save. Theme1.xml is complete.

Now open theme2.xml and add extra color themes from theme1.xml and theme3.xml. Finally add the colors from theme1.xml and theme2.xml to theme3.xml. Phew! Now every theme contains every color theme. Zip all the xml files back into a presentation and let’s see how this improves the user experience in PowerPoint. After opening the file and moving to a chart that is based on the default master and theme, we can click on Design:Colors and the extra color themes show right at the top of the list:

Alternate Themes Visible

The extra color themes added to the master are shown circled.

Selecting an alternate color theme instantly recolors the chart on the selected slide:

Alternate Applied

An alternate theme is selected and the chart changes colors.

Thanks for reading. Next time I’ll discuss how to add even more custom colors when they won’t all fit into a color theme. If XML hacking isn’t your thing, we can do it for you. Contact me at production@brandwares.com.

7:47 pm

31 thoughts on “OOXML Hacking: Color Themes

  1. Thanks for sharing the information. We have a requirement to Develop Custom Ribbon for MS Office application – Word , PPT and Excel. By default the color palette should be loaded with the custom color theme. How can this be achieved ? Any help.

    • The color palette of 10 theme colors is part of the custom theme. When the theme is applied, the colors are applied to the document. Any document element that was colored with Accent 1 in the previous theme will automatically acquire the color that is set as Accent 1 in the new theme.

      I have haven’t understood your question, please supply more details about what problems you are having.

  2. Thanks for the response. The requirement is, when I open new document, the color palette grid should be set to the custom color theme that I had created. Also how can custom theme be created programmatically using VSTO Word AddIns.

    • The custom color theme will already be set when you create a new document from a template or theme. You can set PowerPoint, Word and Excel templates to be default templates, which means that every new document will have the custom color theme by default. You can find the details by searching set PowerPoint template as default, for example.

      The simplest way to create an add-in that can create a theme would be to write a VBA routine to set the theme colors and save the file as a theme. Then you would save this code as an add-in. Neither of these operations are simple unless you are already familiar with VBA and creating add-ins.

      I would be happy to create such an add-in for you. Please write to me at production at brandwares dot com with the details of how you want the Word add-in to function and I’ll send you an estimate at no charge.

  3. Hi there! first of all thats a wow tutorial. It works!
    Only issue i am not sure how to make the fail POTX again. the procedure was (potx->open in winzip, unarchive ->got the three folders, changed what i needed -> put back to zip) and there is the issue now it is named template.potx but show still as zip file. Yes it works but is there a possibility to make it potx (the status of the file) again ?

    • By default, Windows does not display the file endings in the file name. If you can’t see it, you can’t fix it. Once the file is zipped, manually changing the file ending from .zip to .potx will make it act like a PowerPoint file again.

      • Oh I’m sorry, I think I’m not even in the right topic.
        Anyway I was asking for any color scheme hacked xml file with some custom colors enabled so I can use and modify it.
        Thanks.

        • Sorry, you can add custom colors to a full theme file (ends with .thmx), but not in a color theme file (ends with .xml). Here is my article about adding custom colors to a full theme. I’ll be updating this information soon, but it should get you started.

  4. Hi John your site is very useful.

    Can you please tell me how and which XML file do I edit to give a different color for sub elements in SmartArt. Now each element are set to the default accent 1 color. I want it to take the accent 1, accent 2, accent 3… color as default color when a SmartArt is created not just the accent 1 color uniformly.

    Thank

    Godwin

      • Thanks John, but actually that will only replace Accent 1 with Accent 2, I PRESUME. Correct me if I am wrong. I actually have to use Accent 1, Accent 2, Accent 3 … as the as the default color for all SmartArt. Similar to charts elements taking different colors.

  5. Hi there,

    I have hacked the XML to have 27 custom colors and when you mouseover it shows the “name” of the color. I’d like to break the 27 into 7 different buckets so that I don’t have to mouse over so many to find the right color. Is that possible? I thought the themes might do it but it doesn’t seem to.

    To get the 27 colors I edited only theme1.xml with this:










    ………. (to get to 27 colors)

    • Forgot to read the part about posting XML. Here it is
      &lta:custClrLst&gt
      &lta:custClr name=”myColorName1″&gt
      &lta:srgbClr val=”BEBEBE”/&gt
      &lt/a:custClr&gt
      …………repeated to get to a big list of 27
      &lt/a:custClrLst&gt

  6. So the best organization I could do is to alphabetize them so when I hover, they’re in alpha order, but I’m limited to 50. I was hoping maybe instead of a list of colors 10×5, I could break “Custom colors” up into “category 1’s colors”… then a list, then “category 2s colors”….

  7. This has worked great for me in PPT, but when I use the same xml code for a Word document, the custom color schemes don’t show up in the colors dropdown. I’m on a mac. Any idea why they don’t show up?

    • Sorry, I’m not seeing any problem with custom colors in Word 2016 or 2019 for Mac. Custom colors don’t work in Word 2008 or Word 2011, in case you’re testing on those.

      • Thanks so much for the quick response!

        I may not have explained that in enough detail. I’m using the theme1.xml to add in some custom color palettes. I have the main color scheme up top in the .xml customized, and those colors show up fine in the fonts and object color selectors in the UI, but when I look at the colors dropdown in the design tab, the theme doesn’t show up in the “Custom” section like in PPT. I also have added 3 additional color themes in the “Extra Color List” section at the bottom, and none of those show up in the “Custom” section like in PPT. Any idea why those show up in PPT in the custom colors dropdown in the design tab, but not in Word?

        • The Design>Colors dropdown custom section displays color themes that have been created on that computer. It doesn’t display the color theme that’s in the document you have open.

          If there is a saved color theme file that matches the color theme in your document, then the custom section will display the color theme with a grey highlight around it. However, the color theme name in your document might be completely different than the name of the color theme file that is displayed. That’s because the Office programs checks the RGB color values, not the theme name.

          In PowerPoint, there can be separate slide masters that can have different color themes. Word doesn’t have any structure like that. So there isn’t much point to switch Extra Color Scheme palettes, you can do exactly the same thing by just applying an ordinary color theme. That’s my guess, anyway.

    • Unfortunately, no. Color naming for the theme colors and the variants below them are created automatically by an algorithm built into the program.

      It’s an often-requested feature, so use the Feedback in all Office programs to send a suggestion that user-set names should be an option.

      • Ok thanks anyway John.

        Your hacks really saved my day. I’ve been using the plugin for Chrome, and it’s really easy to use.

Leave a Reply

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

Posting XML? To enter XML code, please replace all less than signs "<" with "&lt;" and greater than signs ">" with "&gt;". Otherwise, Wordpress will strip them out and you will see only a blank area where your code would have appeared.