The current Office JavaScript API for PowerPoint (as of now) does not provide a direct way to get the slide background color or theme color through a documented or supported call.
Not Yet Supported
Unfortunately, these are not currently accessible:
- Background color of a slide
Theme colors or design applied to a presentation
Master slide styles
There is no Office.js method like slide.background.color
or presentation.theme
available right now.
Workaround Ideas (Limited)
- Manually use shapes/layers to infer background
If your slide background is actually a filled shape, you can access that shape and inspect its fill
:
PowerPoint.run(async (context) => {
const slides = context.presentation.slides;
slides.load("items");
await context.sync();
const shapes = slides.items[0].shapes;
shapes.load("items/fill");
await context.sync();
shapes.items.forEach(shape => {
console.log("Fill Type:", shape.fill.type); // e.g., "Solid"
// Unfortunately no color info is exposed yet
});
});
But note: this only works if the slide background is created using a shape.
- Use Office Add-in to Export Slide as Image and Analyze Color
This is a hacky workaround:
Export slide as an image (not available in JS API, but possible via VBA or desktop automation)
Use color analysis on the exported image to infer background
- VBA as Alternative (Desktop only)
In VBA, you can read theme color and slide background formatting, e.g.:
Sub GetSlideBackgroundColor()
Dim slide As slide
Set slide = ActivePresentation.Slides(1)
MsgBox slide.FollowMasterBackground ' True or False
' Unfortunately, background color itself is not directly readable
End Sub
Even in VBA, it’s limited unless the background is explicitly set using shapes or fill formatting.