Agent-driven creation of editable, tastefully crafted visual artifacts.
Python
Theme
Themes provide named colors and text style tokens.
Color Scheme
presentation.theme.colorScheme = {
name: themeName,
themeColors,
};
const hexMap = presentation.theme.hexColorMap;
themeColors maps every theme color name to a color config value. Assigning
presentation.theme.colorScheme replaces the active scheme, so provide the
full map.
Color Scheme Inline Type
type ThemeColorName =
| "accent1" | "accent2" | "accent3" | "accent4" | "accent5" | "accent6"
| "bg1" | "bg2" | "tx1" | "tx2" | "dk1" | "lt1" | "dk2" | "lt2"
| "hlink" | "folHlink";
type ColorSchemeConfig = {
name: string;
themeColors: Record<ThemeColorName, ColorConfig>;
};
Theme Colors In Content
const shape = slide.shapes.add({
geometry,
position,
fill: themeColorName,
line: { style: lineStyle, fill: lineColor, width: lineWidthPx },
});
Text Styles
const styles = slide.theme.textStyles({
[styleName]: textStyleConfig,
});
Cookbook
// Business/product palette.
presentation.theme.colorScheme = {
name: "Product Editorial",
themeColors: {
accent1: "#2563eb",
accent2: "#0f766e",
accent3: "#f59e0b",
accent4: "#dc2626",
accent5: "#7c3aed",
accent6: "#16a34a",
bg1: "#ffffff",
bg2: "#f8fafc",
tx1: "#0f172a",
tx2: "#475569",
dk1: "#000000",
dk2: "#1e293b",
lt1: "#ffffff",
lt2: "#e2e8f0",
hlink: "#2563eb",
folHlink: "#7c3aed",
},
};
// Use theme tokens in content so later theme changes flow through.
slide.background.fill = "bg1";
shape.fill = "accent1";
shape.text.style = { color: "tx1" };