0
votes

I want to mimic how PowerPoint automatically chooses a color after the 6 accent colors are used.

In vba you can set the 6 theme colors like this:

.ThemeColorScheme(msoThemeAccent1) = RGB(255, 0, 0)
.ThemeColorScheme(msoThemeAccent2) = RGB(0, 255, 0)
.ThemeColorScheme(msoThemeAccent3) = RGB(0, 255, 255)
.ThemeColorScheme(msoThemeAccent4) = RGB(255, 255, 0)
.ThemeColorScheme(msoThemeAccent5) = RGB(23, 255, 10)
.ThemeColorScheme(msoThemeAccent6) = RGB(23, 255, 100)

The theme colors are manually set here:

Lets say I have a chat with 15 series, powerpoint will use the first 6 account colors but then it automatically picks rgbs which are slightly lighter or darker based on the first 6 accent colors. I want this formula so I can tweak it to my liking. Is this forumla available anywhere?

1

1 Answers

2
votes

The color transformation algorithms have never been published, but they're easy enough to deduce:

  1. Create a sample chart with as many data series as you need.
  2. Save the file, change the ending to .zip and unzip.
  3. Look at ppt/charts/chart1.xml

Office programs don't directly transform RGB values. Instead, they apply filters. Here is a color fill typical of the first 6 series':

<a:solidFill>
    <a:schemeClr val="accent1"/>
</a:solidFill>

Second group of 6:

<a:solidFill>
    <a:schemeClr val="accent1">
        <a:lumMod val="60000"/>
    </a:schemeClr>
</a:solidFill>

Third group:

<a:solidFill>
    <a:schemeClr val="accent1">
        <a:lumMod val="80000"/>
        <a:lumOff val="20000"/>
    </a:schemeClr>
</a:solidFill>

Fourth group:

    <a:schemeClr val="accent1">
        <a:lumMod val="80000"/>
    </a:schemeClr>
</a:solidFill>

Fifth group:

<a:solidFill>
    <a:schemeClr val="accent1">
        <a:lumMod val="60000"/>
        <a:lumOff val="40000"/>
    </a:schemeClr>
</a:solidFill>

Sixth group:

<a:solidFill>
    <a:schemeClr val="accent1">
        <a:lumMod val="50000"/>
    </a:schemeClr>
</a:solidFill>

Unfortunately, there isn't a way in VBA to apply lumMod or lumOff directly. Instead, you need to apply .PictureEffects parameters, then find out which PictureEffect code creates the necessary visual effect. msoEffectBrightnessContrast and msoEffectSaturation will be able to set the same color values with some experimentation. Here is Microsoft's enumeration of Picture Effects: MsoPictureEffectType enumeration (Office)