XML Hacking: Custom Colors

In my last post, I looked at adding extra color themes to PowerPoint masters. But any color theme can only hold a maximum of 10 colors (not counting the hyperlink colors, which are not available in the color picker). Sometimes designers create an expanded palette and they don’t like to be told “Sorry, we can only fit 10, we’ll have to throw out the rest.”, especially after the design has already been approved by the client.

Fortunately, most versions of PowerPoint have a hidden capacity to add up to 50 custom colors. These form a new row below the theme colors and above the stock Microsoft row.

Oct.15, 2015 edit: Chris Robinson brought it to my attention that custom colors are not supported in PowerPoint 2008 or 2011 for OS X. While these versions will open a presentation with custom colors, the colors do not get added to the color picker. Here’s what the color picker in every other variety of PowerPoint looks like after adding custom colors:

Custom Colors in PowerPoint

Custom Colors in PowerPoint

If you’re new to XML hacking, be sure to read my Introduction to the subject first. If you’re editing on a Mac, there are some other considerations covered in this article.

As with the extra color themes we looked at last time, custom colors are added to the XML theme files found in ppt>theme. I mentioned in the last article, presentations almost always include a default Office theme as a fallback and this theme is always last in the list. So in a presentation with 1 color theme, there will be a theme1.xml and a theme2.xml inside the theme folder. Ignore theme2.xml and customize only theme1.xml.

Custom colors are the last category in a theme file, so it’s easy to find. As before, we expand the PowerPoint file (really a zip archive with a different file ending), open ppt/theme, open theme1.xml in a text editor and reflow the text to be humanly readable. Then scroll all the way down to the end. An unmodified file will only display the <a:extraClrSchemeLst/> stub to which you add custom color themes. To add custom colors, we add a new branch to the tree. Between <a:extraClrSchemeLst/> and </a:theme>, we type a new entry: <a:custClrLst>. This is followed by our custom color definitions and the closing tag </a:custClrLst>. Here’s what a list of custom colors as seen in the screenshot above would look like in XML:
Custom Color List

A nice feature here is that, unlike color themes, you can actually supply a name for the color. This is followed a hexadecimal RGB color value, as used in web design. This list has only 8 colors, but there is room for up to 50 in the custom color area. If you read the last article about color themes, you’ll soon realize that each theme file can have a different set of custom colors that goes with it as well. The combination of themes and custom colors gives you 18 colors per theme to play with, almost enough for the most color-crazed designer.

Custom colors can be added to the theme1.xml file in Word and Excel using exactly the same syntax. The colors appear in the color picker as expected in Word but are completely ignored in Excel. It doesn’t complain or raise an error, it just won’t display anything but the standard color dialog. My thanks to Timothy Rylatt for pointing this out.

Another limitation is that custom colors do not travel with a presentation saved as a Theme (*.thmx) file. You’ll have to save as a Presentation (*.pptx, *.pptm) or Template (*.potx, *.potm) to preserve the Custom Colors.

By extension, this also means that you cannot add custom colors to Word by applying a PowerPoint theme file. Instead, you must hack the Word document or template to get them. The file name in Word will be the same: theme1.xml, but it is to be found in the word/themes folder instead of ppt/themes. As with PowerPoint, custom colors are added to the very end of the theme.xml part.

Unlike theme colors, custom colors are not automatically applied to charts. Automatic chart coloring in PowerPoint, Excel and Word is limited to 6 settable colors (see this post for chart coloring details). After that, the host program starts generating automatic variants based on the theme. However, for the detail-oriented among us, manual recoloring of data series with custom colors is very convenient and miles above the previous technique, inputting RGB values from text.

We’re here to do this for you, if you prefer! Please contact me at production@brandwares.com. Next time, I’ll tackle formatting custom table formats in XML. This is a complex subject, so it will take at least 2 posts. Stay tuned!

9:35 pm

55 thoughts on “XML Hacking: Custom Colors

  1. Thanks for this — good stuff. I am on a Mac. This seems to work ok for me on PowerPoint 2016 but does not show up in PowerPoint 2011 which from the screenshot above seems to be what you used on this. Any thoughts?

  2. Thanks again for checking on this for me. Had time to play with it over the weekend and worked as you said across everything but those — so just will do your suggestion and add those in as a reference page for those using those 2 versions. Thanks for your help — great series of articles — has been very useful!!

  3. Thanks very much for the post. I’ve found this xml hack a while back too and it’s proofed very useful. I’m currently exploring ways to write these xml nodes with VBA but so far to no avail. Have you got any hints on how to go about this? Thanks for any pointers you may be able to give me.

    • Unfortunately, there’s no way to set a style that automatically removes underlines from hyperlinks in PowerPoint, though the same thing is easy in Word. Instead, you have to work around it with each hyperlink by removing the hyperlink from the text, then adding a transparent shape over top that is hyperlinked. Here’s a page from Microsoft with the steps: Remove the underline from hyperlink text This was written for 2007, but applies to all versions of PowerPoint.

  4. Hello All,
    Could one of you steer me in the right direction?

    I have made some custom colours for PowerPoint, and they show up and work well.

    I moved this to other PowerPoint documents by, changing the file name to a .zip, then I copied the ‘<a:custClrLst…' section into the other PowerPoint documents 'theme1.xml' file. This all worked well.

    So I tried moving the '<a:custClrLst…' section into the 'theme1.xml' for my Word and Excel templates.

    But when i open the Word and Excel templates i cannot see the extra colour menu.

    Any ideas?

    Thanks
    Colin

    • Excel doesn’t support custom colors in the theme (why not? good question!). With Word, it may be simpler to save your PowerPoint file as a theme and apply the theme to the Word file using the program interface. That should automatically place the custom colors in the right spot. But I’ve made a note to write an update about adding custom colors to Word. Thanks!

  5. Thank you for this article John! Just wanted to share how I solved and issue with the custom colors not appearing in Power Point 2016 file.

    I tried to include some custom colors without success and found that after <a / rel=”nofollow”> there was an <a> xml seccion that had to be removed for the custom colors to appear in the color picker. Tried inserting the custom color seccions before and after the <a> seccion but the custom colors didn’t appear, till I erased all that <a> seccion.

    Thanks for all the great articles.

    Jean Pierre

  6. Thank you SO much for this content! Do you know of a way to override the variants under the accent colors? Those automated values are usually so far off hue or saturation that it’s embarrassing!

    • Unfortunately, those colors are created by PowerPoint on the fly. They are not part of the presentation file, so there is no XML to edit. The algorithm is built into the program and is not user-modifiable.

  7. This code worked for me and I’ve used it in PPT, Excel and Word – though in Word the extended custom colour palette isn’t stable (sometimes disappears – I don’t understand this)
    I mainly use PPT and Xls however and I love it
    What I’d like to know is… if there is a way to customise the table styles. The design options that come with PPT aren’t useful to me. I’d like to be able to put some customed tables in the Table Tools Design Tab. Does anyone know how to do this?

  8. Thanks very much for confirming that the variants – the tints of the accent (theme) colours – were not editable. Thanks also for the xml branching info to add custom colours.

  9. Brilliant – your site is so useful! I have a question about editing XML parts for color and table customisations. I have a lot of documents which were created using a potx template. I then enhanced the template by adding a custom table style, custom colors and a few others things, by unzipping and then editing the xml parts as you explain.

    Now I want to go back to the documents which were created using the original, NON-customised potx, and add the customisations. What is the simplest way of doing this to a whole set of files (apart from manually copying everything into new documents opened from the new template)? Is there a VBA way of doing it? My other thought was a Python script. And one other thing that a quick online search seems to suggest would be something using VSTO, but I don’t know anything about Visual Studio and I can’t seem to find anything directly applicable to this issue – is there a quick way that is worth the learning curve?

    Any suggestions would be greatly appreciated!

  10. Brilliant site, so useful. Apologies if this is a double-post – I tried earlier and don’t see my comment/question.

    I used your explanations to put custom table styles and some custom colors into a potx, which is working great. But I have a bunch of other files that are from the original, non-customised template. Is there a good way of processing all of them so I don’t have to manually add/change the XML for each, or manually copy all the presentations to new documents opened from the new template?

    Is there a VBA way to do it? I don’t know Visual Studio, and I can’t find any obvious way to do this with VSTO via Google. I was also considering writing a Python script. What would be your recommendation for best practice for this?

    Thank you!

    • To get the custom parts in your presentation, you’ll have to create a new file from the POTX that has the custom parts, then use Home>NewSlide>Reuse Slides… to import the slides from the presentation that is lacking the custom parts.

      You might think that using the Design tab to apply a custom theme would work, but unfortunately the custom parts do not get copied over this way.

  11. Hi, this is a fantastic post, thank-you very much. I’ve been successful in applying custom colours into a blank word document, however when I try and adjust the Theme1.xml file in an already mature document the custom colours don’t display. In the unzipped folder structure includes a customXml folder.

    Do you know what might be inhibiting the visibility of the custom colours I’ve added?

    • Hi, after some further testing it seems that the custom colours were applied, however disappear as soon as an object is selected (an object was the first things selected in my template). Do you know how to combat this?

      • When you write “disappear as soon as an object is selected”, do you mean the swatches disappear from the color chooser, or that the object color disappears from the object? By object, do you mean an autoshape, or some other object? What version of Word are you using? If you can email the file in question to me at production at brandwares dot com, I’ll take a look at it.

  12. Hi John,

    Thank you for your post! One quick question, where can I find recent colors tag? I’m trying to erase all recent colors that I have been using to build the master slide. I found that in Excel is .

    Any help would be appreciated!

    Thanks!

    • As noted above the Comment box, please replace the less than sign “<“ with “&lt;” and the greater than sign “>” with “&gt;”. Otherwise, WordPress strips out those characters and only a blank space appears on the page.

  13. Just out of curiosity (and my apologies if this has already been addressed), but is it possible to change the text “Custom Colors” to something like “Colors for Charts Only”?

  14. It seems the custom colors are only accessible for fonts, and not backgrounds (Office 2016, Win10). Is that the behavior others see as well?

    • Sorry for the late reply, I had to do some research on this. Custom Colors appear in the Font Fill, Font Outline, Shape Fill, Shape Outline, Table Shading, Table Border Pen Color and Format Background dialogs in PowerPoint. In Word, Custom Colors do not appear in the Table Shading, Table Border Pen Color or Page Color dialogs, but they are available for fonts and shapes. This is true for Office 2007, 2010, 2013 and 2016, plus 2016 for Mac.

  15. Also, a helpful tip for all: If you use 7-zip (free from 7-zip.org), you can (on Windows at least), right click your document and select “Open as Archive”. Browse to the file, and select “Edit” from the context menu. Make the desired changes, save, and answer yes to the prompt to change the file in the archive. Fini!

  16. Hi
    I used your example and managed to make it work. I want to ask if there is any way to group my colours, for example to make them appear in multiple lines:
    CL1 CL2 CL3
    CL4 CL5 CL6
    CL7 CL8 CL9
    rather than in one row

  17. Excel question: Is there anyway to automatically apply custom colors to every excel workbook opened (e.g., as part of my personal vba workbook or something)? that way if someone sends me an XLSX it will have my custom colors available?

    • Sorry, as noted in the article, Excel does not recognize custom colors and will not display them in any of the color picker dialogs. This hack only works with Word and PowerPoint.

  18. Hi John,
    Thanks a lot for this tut. Seems easy enough to replicate, however, I feel like I might be a bit late to the “show”. I can’t seem to make it work. I’m using Powerpoint for Office 365 (2016).
    I made sure that there all “>” and “<" set correctly, and also made sure that there are no soft quotes like "“" and "”".
    After all the modifications, once I doubleclick on the thmx file, the template is opened correctly, all set as intended except for the custom colors.
    Could it be that this is no longer supported? Or do I have to do it differently?

    I have uploaded my theme1.xml file to dropbox, as well as my entire theme file in case this is useful.
    https://qbdclandauer-my.sharepoint.com/:f:/g/personal/daniel_amstutz_qbdclandauer_onmicrosoft_com/EjtURM_xNTRAnd73edBfPwIBOH62ZK_pRSvxWO85GMUbEQ?e=upy9hQ

    Kind regards,

  19. Hi John, is there a way to apply names to “Theme Colors” the same as “Custom Colors”? For example, $lt;a:accent2$gt;$lt;a:srgbClr val=”818A37″/$gt; is given the name “Dark Green”, and I don’t know where that name comes from. Can I name it “Olive” instead? I.e. when resting the mouse in the color picker, I want the name “Olive” to appear instead of “Dark Green”. In other words, is there a “name” tag that complements the “val” entry for the theme color? Thanks!

    PS: expecting my comment #23 will be updated with this corrected version using your XML provided instructions (sorry for the confusion).

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.

This site uses Akismet to reduce spam. Learn how your comment data is processed.