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: 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, there’s no equivalent in Excel, 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

2 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

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.