Skip to content

Class: Theme ​

A deck's theme part (theme1.xml) as a modeled object. Exposes the two property tiers a slide resolves against: the colorScheme (the 12 a:clrScheme slots as literal hex, a:sysClr resolved via its lastClr) and the fontScheme (major/minor Latin/EA/CS faces). Reachable from SlideMaster.theme and Slide.theme.

Constructors ​

Constructor ​

new Theme(part): Theme

Parameters ​

ParameterTypeDescription
partPartThe theme's OPC part (/ppt/theme/themeN.xml).

Returns ​

Theme

Properties ​

part ​

readonly part: Part

The theme's OPC part (/ppt/theme/themeN.xml).

Accessors ​

colorScheme ​

Get Signature ​

get colorScheme(): Record<ThemeColorSlot, string | null>

The theme colour scheme: the 12 ThemeColorSlots resolved to a 6-hex RGB (an a:sysClr slot resolves through its lastClr). A slot the theme does not define reads null. Use color to look one slot up.

Returns ​

Record<ThemeColorSlot, string | null>


colorSchemeName ​

Get Signature ​

get colorSchemeName(): string | null

Colour-scheme name (a:clrScheme/@name, e.g. Office), or null.

Returns ​

string | null


element_ ​

Get Signature ​

get element_(): Element | null

Escape hatch: the underlying a:theme element. After mutating it call markDirty, or save() writes the original bytes.

Returns ​

Element | null


fontScheme ​

Get Signature ​

get fontScheme(): ThemeFontScheme | null

The theme's a:fontScheme (major/minor font families), or null when the theme declares none.

Returns ​

ThemeFontScheme | null


name ​

Get Signature ​

get name(): string | null

Theme name (a:theme/@name, e.g. Office Theme), or null when unnamed.

Returns ​

string | null


partName ​

Get Signature ​

get partName(): string

Partname of the theme part.

Returns ​

string

Methods ​

color() ​

color(slot): string | null

The 6-hex RGB of one colour-scheme slot, or null when the theme does not define it.

Parsed once per proxy: the whole a:clrScheme is read to answer for one slot, and a caller asking for several -- which is the normal way to ask -- re-read it each time.

Parameters ​

ParameterType
slot"accent1" | "accent2" | "accent3" | "accent4" | "accent5" | "accent6" | "hlink" | "folHlink" | "dk1" | "lt1" | "dk2" | "lt2"

Returns ​

string | null


markDirty() ​

markDirty(): void

Mark the theme part dirty so save() reserializes it. Call after mutating element_.

Returns ​

void