Skip to main content

Module theme

Module theme 

Source
Expand description

Office 主题 <a:theme> 标准版。

PowerPoint 强制要求一份合法的 theme1.xml,否则会被 Office/WPS 拒绝打开。 这里直接采用 python-pptx 默认输出的 Office 主题,保留完整结构与所有字体脚本。 出于二进制大小考虑,省略了 latin/ea/cs 之外的 <a:font> 列表(实际 Office 主题里全是它们)。

§与 python-pptx 的对应

  • pptx.oxml.theme.Theme ←→ Theme 结构体(v0.2 起支持结构化解析);
  • pptx.parts.theme.ThemePart._element 在加载时由 parse_theme 解析为 Theme
  • 写路径使用 Theme::to_xml(结构化序列化)或 default_theme_xml(完整 Office 主题 XML)。

§字体脚本表

THEME_XML 完整列出了 30+ 个 script(Jpan / Hang / Hans / Hant / …), 缺失任何一个都会导致 PowerPoint 警告“主题不完整“。

Structs§

ColorScheme
颜色方案(对应 <a:clrScheme>)。
FontScheme
字体方案(对应 <a:fontScheme>)。
FormatScheme
格式方案(对应 <a:fmtScheme>)。
Theme
结构化主题模型(对应 <a:theme>)。

Enums§

ThemeColor
主题颜色值(对应 <a:srgbClr><a:sysClr>)。

Functions§

default_theme_xml
返回完整且经过验证的 Office 主题 XML(与 python-pptx 默认输出对齐)。