OOXML Hacking: Recent Colors

Recent colors are handled inconsistently by Microsoft Office programs. Word and Outlook only retain recently used colors only as long as the program is running, and those colors are visible in every document that’s open. By contrast, PowerPoint and Excel both include them in the document. As soon as you open a different file, the previous colors disappear from the color picker. Return to the first document and there they are again.

If you’re creating files for clients, you may generate quite a few colors in the design process. Your work will look a little more professional if you purge the Recent Colors from the PowerPoint or Excel file before sending it on.

If you’re new to XML hacking, please read my intro: XML Hacking: An Introduction. If you’re working on a Mac, you should also read XML Hacking – Editing in macOS.

Recent Colors in the Windows Color Picker

The row of Recent Colors that PowerPoint and Excel include in the file is a distraction for your client.


Recent Colors Removal Steps

Under Windows, begin by unzipping the file. On a Mac, open it in BBEdit or other advanced text editor.

If this is a PowerPoint deck, look in the ppt folder for the presProps.xml file. The recent colors begin on the third line of a prettified (human-readable) file. Simply delete the entire clrMru section:

<p:clrMru>
  <a:srgbClr val="A54DA5"/>
  <a:srgbClr val="C8006E"/>
  <a:srgbClr val="64006E"/>
</p:clrMru>

To remove the Recent Colors from an Excel workbook, open the xl folder, then edit styles.xml. Look for the colors section, then delete the entire mruColors part:

<colors>
  <mruColors>
    <color rgb="FF640064"/>
    <color rgb="FF393939"/>
  </mruColors>
</colors>

After editing, rezip the files if you’re using Windows or save and close in your macOS text editor. Test that the file opens as expected and no longer has Recent Colors in the color picker, that send it off to the client.

Recent Colors Removed

A more presentable dialog for your client.


PowerPoint VBA to Remove Recent Colors

There’s a simple alternative if you’re using PowerPoint for Windows: you can run a macro to remove the recent colors. It’s dead simple, here’s the code:

Sub ClearRecentColors()
  ActivePresentation.ExtraColors.Clear
End Sub

Unfortunately, PowerPoint for Mac VBA is missing the .Clear method, so you’ll have to hack the file. There’s VBA no equivalent in Excel for Windows or Mac, you’ll have to edit the XML to get rid of them.


Don’t Reuse Recent Colors

Occasionally an artist will try to include special colors in the Recent Colors section, to give the client some additional color choices. This is a bad idea because the Recent Color section is dynamic. When any new color is created, it’s added to the left end of Recent Colors. If the row is full, the oldest color gets pushed off the right end. A better solution is to create Custom Colors. Here’s my how-to on the subject. Custom Colors don’t move or change and can be named, which is a little extra help for your client.

10:33 pm

8 thoughts on “OOXML Hacking: Recent Colors

  1. PowerPoint theme colors issue: I entered the RGB values from client’s brand guidelines. Saved Theme Colors and .thmx file. I even went into the Theme Color .xml file and compared the Hex codes to be sure they matched the Brand colors. Closed PowerPoint file, opened it again. Double checked them. Still accurate. Sent final file to the client. On her end, the colors in the same file have changed slightly and no longer match the brand guideline mixes. This keeps happening, and I don’t know why. I am working on a Mac; client is PC based. Do you have any solutions for this?
    Thanks!

    • This is a known problem with the Mac version of PowerPoint. In edit mode, the interface uses macOS color management. Why Microsoft made this decision, I have no idea, because color management would make more sense in slideshow mode, not edit mode. The solution is to use a third-party color picker that doesn’t use color management. These color pickers are usually made for web developers who need accurate hex colors. Here’s my article with more detail: Mac PowerPoint: Accurate Colors – Best Practices

  2. Excellent article as always! Although I was looking for something more specific and landed here. Perhaps you can help. PowerPoint text highlighter comes with a set of default colors and then the work around I found for custom highlighting colors is to add them to recent colors.
    So, the question is, can I edit the default highlighting colors or, instead of deleting the recent colors, I provide the template with custom recent colors (knowing that they are dynamic and the use is limited).

    • You would have to provide recent colors in your file. The default highlight colors are created by the program, not stored in the presentation files, so there is no simple method to change them.

  3. John for my recent powerpoint vba work, you have been a life saver. You have done brilliant work on the forums + stackoverflow.

    Similar to ActivePresentation.ExtraColors.Clear is there a way to clear customColors ?

    • Thanks for your kind words. Custom Colors have never been added to the program interface, so they have never been included in the VBA object model either. You would have to apply a new theme that didn’t include the custom colors.

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.