A theme part, usually ppt/theme/themeN.xml, is reached from a master’s
theme relationship. It is DrawingML with the root element
a:theme, and it has a name.
What a theme holds
a:themeElements holds three schemes:
| Element | Holds |
|---|---|
a:clrScheme | Twelve named colours: dk1, lt1, dk2, lt2, accent1 to accent6, hlink, folHlink. Each is a:srgbClr or a:sysClr. |
a:fontScheme | The theme fonts: a:majorFont for headings and a:minorFont for body text, each naming a a:latin typeface and fonts for other scripts. |
a:fmtScheme | Fills, line styles and effects that shapes can use. |
Shapes use a theme colour with a:schemeClr, which holds a name instead of a
colour value. The master’s p:clrMap maps those names to the twelve colours.
Rules, children and divergences
Sources read: ECMA-376 5th edition Part 1 (research/ooxml/ecma376/p1/part1.txt) 14.2.7 (theme part), 14.2.8 (theme override part),
20.1.4.1.7-20.1.4.1.20 (bgFillStyleLst, custClr, fillStyleLst, fmtScheme,
font, fontRef, fontScheme, lnDef), 20.1.4.2.10 (fillRef), and the Annex A.4.1
types CT_OfficeStyleSheet, CT_BaseStyles, CT_ColorScheme, CT_FontScheme,
CT_FontCollection, CT_StyleMatrix, ST_FontCollectionIndex, ST_StyleMatrixColumnIndex;
python-pptx oxml/theme.py and Apache POI XSLFTheme.java (research/pptx/src/).
- Parts. The content type is
application/vnd.openxmlformats-officedocument.theme+xml; the root element istheme. A presentation package has zero or one theme part for each handout master, notes master, slide master and for the presentation itself, through an implicit relationship. A theme part may have explicit relationships only to images, and none to any other part (14.2.7). A theme override part (content typethemeOverride+xml, relationshipthemeOverride, root element writtenossOverridein 14.2.8,CT_BaseStylesOverridein the schema) overrides the colour, font and format scheme for one slide, notes slide or slide layout, zero or one per part, with no relationships of its own. a:theme(CT_OfficeStyleSheet): children in orderthemeElements(required),objectDefaults,extraClrSchemeLst,custClrLst,extLst; optionalname(default empty).custClrLstholds custom colours (a:custClrwith aname) shown in the colour picker as extra corporate colours (20.1.4.1.8).a:themeElements(CT_BaseStyles):clrScheme,fontScheme,fmtScheme(all three required, in this order),extLst.a:clrScheme: exactly the twelve colours in the orderdk1,lt1,dk2,lt2,accent1toaccent6,hlink,folHlink, thenextLst; all twelve are required, andnameis required (CT_ColorScheme, Annex A and Annex L).a:fontScheme(requiredname):majorFontthenminorFont, both required. Each (CT_FontCollection) must holdlatin,eaandcsin that order, then any number ofa:fontelements (ascript, ISO 15924 names recommended, and atypeface), thenextLst. AfontRef(used in shape styles) hasidxmajor,minorornone(ST_FontCollectionIndex) and a colour child.a:fmtScheme(CT_StyleMatrix, optionalname):fillStyleLst,lnStyleLst,effectStyleLst,bgFillStyleLst, all required and in this order. Each list holds three entries ordered subtle, moderate, intense. The index used byfillRef,lnRefandeffectRefis an unsigned integer (ST_StyleMatrixColumnIndex); forfillRef, 0 or 1000 means no fill, 1 to 999 select a fill style fromfillStyleLstand 1001 upward select a background fill style (1001 is the first) frombgFillStyleLst(20.1.4.2.10).- Scheme colour names.
a:schemeClrvalues such astx1andbg1are resolved through the master’s colour map to the twelve names above; a reader that only knows the twelve names, such as POI’sXSLFTheme.getMapColor(lines 96-115, which returns nothing for any other name), must do that mapping first.
Divergence from spec
- 14.2.8 names the override root
ossOverride, while the schema in Part 1 defines the override type asCT_BaseStylesOverride(clrScheme, and so on, each optional); the root name is taken from the part description only. - POI reads only the
latintypeface of the major and minor fonts (getMajorFont,getMinorFont, lines 143-154), not theea,csor script-specificfontentries. python-pptx’sCT_OfficeStyleSheetdeclares the five children in the schema order and builds a default theme for a new notes master from a template, and reads nothing else of the theme. - POI’s
getMajorFontandgetMinorFont(lines 143-155) go straight tofontSchemeandlatinwith no check, so a theme missing either (the schema requires both, so such a file is invalid) fails there; the explorer falls back to its default font instead.getMapColor(lines 96-115) knows onlyaccent1toaccent6,dk1,dk2,lt1,lt2,hlinkandfolHlinkand returns nothing fortx1,bg1and the like; the standard lists exactly these twelve inclrScheme.