How to freeze the color of selected shape so that changing theme color should not affect the shape color in power point using Office JS API

Amira Muzaffar 0 Reputation points
2023-02-27T16:23:59.15+00:00

I am trying to freeze the color of the shape which user has selected, so once the shape color is set frozen the theme color should not apply on it. To set the color of the shape I am using the below code. but I could not find anything regarding freeing the shape color with Office JS. Is there any method available to freeze the color. Even if the user change the theme, the color of the shape should not get changed.

const shapes = context.presentation.getSelectedShapes();
const shapeCount = shapes.getCount();
shapes.load("items");
await context.sync();
shapes.items[0].fill.setSolidColor("red");
await context.sync();

I tries setting the color manually and its working but I need to freeze the color so that I cannot changed with different theme set up for the slide.

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
864 questions
0 comments No comments
{count} votes