scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.26k stars 499 forks source link

Change the theme colors #917

Closed GYC-lab closed 9 months ago

GYC-lab commented 9 months ago

Thanks for this useful library firstly!

My question is, how to change the theme colors?

As far as I know, the theme colors are related to MSO_THEME_COLOR.ACCENT_1, MSO_THEME_COLOR.ACCENT_2, ...

But how to change the detailed RGB values of these MSO_THEME_COLOR?

It would save a lot to time if there is a way to modify the RGB values of MSO_THEME_COLOR. Otherwise, I think I would have to match those color with theme colors and then change them.

Looking forward to your reply!

scanny commented 9 months ago

Create an empty presentation with the theme you want and then use that as the starting place, like prs = Presentation("my-template.pptx").

GYC-lab commented 9 months ago

Create an empty presentation with the theme you want and then use that as the starting place, like prs = Presentation("my-template.pptx").

Thank you for the in-time reply!

So the theme colors of the empty presentation which will be served as a template has to be set manully?

scanny commented 9 months ago

The theme colors are already in the "starting" presentation. So you just create one that looks the way you want and then those theme colors are available to you to select by name.

There's no current way to change the theme colors of an existing presentation, you'll be on your own for that.

The names ACCENT_1 etc. are just slots for different colors. Each theme places their choice of colors in those slots.