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 Office programs beginning with 2007 have a hidden capacity to display up to 50 custom colors. These form a new row below the theme colors and above the stock Microsoft row. Custom colors are not supported in PowerPoint 2008 or 2011 for OS X. While these versions will open a file with custom colors, the colors do not get added to the color picker. Here's what the color picker in every other variety of Word or PowerPoint looks like after adding custom colors:
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. I should also clarify: a Color Theme or a Font Theme are only sub-parts of a Theme as saved by PowerPoint. A PowerPoint Theme file contains the entire presentation, including masters, layouts, and full theme files. It's this full theme file that we need to edit. Custom Colors never appear in a Color Theme file.
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:
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 partially ignored in Excel. In Excel, custom colors display for almost all objects on the Insert tab: Text Boxes, Shapes, SmartArt, Charts, WordArt, etc. But if you're seeking to format worksheet text, cell fills or borders, custom colors do not show. (Thanks to reader Kaz for pointing this out.)
Another limitation is that if you save a presentation as a Theme (*.thmx) file, custom colors in the presentation don't get added to the Theme file. You'll have edit a saved Theme file to add the custom colors to it, then they can be applied to another file. Or you can save the original presentation as a Presentation (*.pptx, *.pptm) or Template (*.potx, *.potm) to preserve the Custom Colors.
By extension, this also means that to add custom colors to Word by applying a PowerPoint Theme file, you must edit the Theme file to add the custom colors. Or course, you can 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 email@example.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!