PPTX
Styles and Themes
Apply color schemes, theme colors, and consistent styling across slides
Apply consistent styling across your presentation using fills, outlines, and color schemes.
#Solid Fill on Shapes
import { generatePresentation } from "@office-open/pptx";
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "13.2cm",
"height": "5.3cm",
"textBody": {
"paragraphs": [
{
"children": [
{
"text": "Blue background",
"fill": "FFFFFF",
"size": 20
}
]
}
]
},
"properties": {
"fill": {
"type": "solid",
"color": "2E74B5"
}
}
}
}
]
}
]
}
{
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "13.2cm",
height: "5.3cm",
properties: {
fill: { type: "solid", color: "2E74B5" },
},
textBody: {
paragraphs: [
{ children: [{ text: "Blue background", fill: "FFFFFF", size: 20 }] }
],
},
},
},
],
},
],
}
#Gradient Fill
Linear gradient with angle:
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "15.9cm",
"height": "6.6cm",
"properties": {
"fill": {
"type": "gradient",
"stops": [
{
"position": 0,
"color": "0D47A1"
},
{
"position": 50,
"color": "1976D2"
},
{
"position": 100,
"color": "42A5F5"
}
],
"angle": 45
}
}
}
}
]
}
]
}
{
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "15.9cm",
height: "6.6cm",
properties: {
fill: {
type: "gradient",
stops: [
{ position: 0, color: "0D47A1" },
{ position: 50, color: "1976D2" },
{ position: 100, color: "42A5F5" },
],
angle: 45,
},
},
},
},
],
},
],
}
Path gradient (radial):
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "10.6cm",
"height": "10.6cm",
"properties": {
"geometry": "ellipse",
"fill": {
"type": "gradient",
"stops": [
{
"position": 0,
"color": "FFFFFF"
},
{
"position": 100,
"color": "1565C0"
}
],
"path": "circle"
}
}
}
}
]
}
]
}
{
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "10.6cm",
height: "10.6cm",
properties: {
geometry: "ellipse",
fill: {
type: "gradient",
stops: [
{ position: 0, color: "FFFFFF" },
{ position: 100, color: "1565C0" },
],
path: "circle",
},
},
},
},
],
},
],
}
#No Fill (Transparent)
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "13.2cm",
"height": "5.3cm",
"properties": {
"fill": {
"type": "none"
},
"outline": {
"color": "2E74B5",
"width": 2
}
}
}
}
]
}
]
}
{
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "13.2cm",
height: "5.3cm",
properties: {
fill: { type: "none" },
outline: { color: "2E74B5", width: 2 },
},
textBody: { text: "Transparent shape with border" },
},
},
],
},
],
}
#Outline
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "13.2cm",
"height": "6.6cm",
"properties": {
"fill": {
"type": "solid",
"color": "E3F2FD"
},
"outline": {
"color": "1565C0",
"width": 2
}
}
}
}
]
}
]
}
{
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "13.2cm",
height: "6.6cm",
properties: {
fill: { type: "solid", color: "E3F2FD" },
outline: { color: "1565C0", width: 2 },
},
textBody: { text: "Bordered shape" },
},
},
],
},
],
}
#Color Scheme Tips
Define a consistent palette and reuse it:
import { generatePresentation } from "@office-open/pptx";
const colors = {
primary: "2E74B5",
secondary: "70AD47",
accent: "ED7D31",
dark: "1F3864",
light: "D6E4F0",
white: "FFFFFF",
};
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "13.2cm",
height: "5.3cm",
properties: {
fill: { type: "solid", color: colors.primary },
},
textBody: {
paragraphs: [
{
children: [{ text: "Title", fill: colors.white, bold: true, size: 24 }],
},
],
},
},
},
],
},
],
});
#Background Styles
Apply background styling at the slide level:
{
"slides": [
{
"background": {
"fill": "1F3864"
},
"children": []
}
]
}
{
slides: [
{
background: { fill: "1F3864" },
children: [],
},
],
}
{
"slides": [
{
"background": {
"fill": {
"type": "gradient",
"stops": [
{
"position": 0,
"color": "0D47A1"
},
{
"position": 100,
"color": "42A5F5"
}
],
"angle": 135
}
},
"children": []
}
]
}
{
slides: [
{
background: {
fill: {
type: "gradient",
stops: [
{ position: 0, color: "0D47A1" },
{ position: 100, color: "42A5F5" },
],
angle: 135,
},
},
children: [],
},
],
}