Themes and Color Schemes

Witan exposes PowerPoint theme color schemes through the Office.js-compatible themeColorScheme object. Theme colors are useful when a deck should stay visually consistent while an agent changes branding, emphasis colors, or scoped slide styling.

Theme colors affect visuals that reference the deck theme: shape fills and lines, text, backgrounds, tables, charts, and rendered slide output.

Scopes

Theme color schemes are available at three presentation scopes:

Scope Object Typical use
Slide master slideMaster.themeColorScheme Change colors inherited by layouts and slides that do not override them.
Slide layout layout.themeColorScheme Change a layout family, such as title slides or section dividers.
Slide slide.themeColorScheme Change one slide without changing the rest of the deck.

Inheritance follows normal PowerPoint behavior: slide overrides win over layout overrides, and layout overrides win over master colors.

Read Colors

getThemeColor(...) returns an OfficeExtension.ClientResult<string>. Read .value after await context.sync().

return await PowerPoint.run(async context => {
  const slide = context.presentation.slides.getItemAt(0);
  const accent = slide.themeColorScheme.getThemeColor(PowerPoint.ThemeColor.accent1);
  const text = slide.themeColorScheme.getThemeColor(PowerPoint.ThemeColor.dark1);

  await context.sync();
  return {
    accent1: accent.value,
    text: text.value
  };
});

Write Colors

Use setThemeColor(...) with a PowerPoint.ThemeColor value and a hex RGB color.

return await PowerPoint.run(async context => {
  const master = context.presentation.slideMasters.getItemAt(0);
  master.themeColorScheme.setThemeColor(PowerPoint.ThemeColor.accent1, "#224466");
  master.themeColorScheme.setThemeColor(PowerPoint.ThemeColor.accent2, "#D97706");

  await context.sync();
  return true;
});

Master writes affect slides and layouts that inherit those theme slots. Layout and slide writes create scoped overrides.

Scoped Overrides

Set a layout color when a group of slides should share a variant:

return await PowerPoint.run(async context => {
  const slide = context.presentation.slides.getItemAt(0);
  const layout = slide.layout;

  layout.themeColorScheme.setThemeColor(PowerPoint.ThemeColor.accent1, "#0F766E");

  await context.sync();
  return true;
});

Set a slide color when only one slide should change:

return await PowerPoint.run(async context => {
  const slide = context.presentation.slides.getItemAt(0);
  slide.themeColorScheme.setThemeColor(PowerPoint.ThemeColor.accent1, "#7C3AED");

  await context.sync();
  return true;
});

When a slide override exists, later changes to the same color slot on the layout or master do not replace that slide-local value.

Supported Slots

Witan accepts these theme color slots:

Theme color Purpose
dark1, light1 Primary text/background pair.
dark2, light2 Secondary text/background pair.
accent1 through accent6 Brand and chart accent colors.
hyperlink, followedHyperlink Link colors.

mixed and none are enum values for Office.js compatibility, but they are not valid inputs for getThemeColor(...) or setThemeColor(...).

Rendering

After changing theme colors, render the affected slides to verify inherited formatting:

witan pptx render deck.pptx --slide 1 -o themed-slide.png

Theme-dependent charts, tables, backgrounds, text, and shape styling are resolved by the slide renderer. Use Render and pixel diffs when a theme change needs regression coverage.