PPTX
Effects and Fills
Apply shadows, glow, 3D effects, and various fill types to shapes
Enhance shapes with visual effects (shadows, glow, 3D) and fills (solid, gradient, image, transparent).
Solid Fill
import { generatePresentation } from "@office-open/pptx";
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "10.6cm",
"height": "6.6cm",
"fill": { "type": "solid", "color": "2E74B5" }
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "10.6cm",
height: "6.6cm",
fill: { type: "solid", color: "2E74B5" },
},
},
],
},
],
});
Short form — pass a color string directly:
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "10.6cm",
"height": "6.6cm",
"fill": "2E74B5"
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "10.6cm",
height: "6.6cm",
fill: "2E74B5",
},
},
],
},
],
});
Gradient Fill
Linear Gradient (with angle)
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "15.9cm",
"height": "6.6cm",
"fill": {
"type": "gradient",
"stops": [
{ "position": 0, "color": "0D47A1" },
{ "position": 100, "color": "42A5F5" }
],
"angle": 45
}
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "15.9cm",
height: "6.6cm",
fill: {
type: "gradient",
stops: [
{ position: 0, color: "0D47A1" },
{ position: 100, color: "42A5F5" },
],
angle: 45,
},
},
},
],
},
],
});
Radial Gradient (with path)
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "10.6cm",
"height": "10.6cm",
"geometry": "ellipse",
"fill": {
"type": "gradient",
"stops": [
{ "position": 0, "color": "FFFFFF" },
{ "position": 100, "color": "1565C0" }
],
"path": "circle"
}
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "10.6cm",
height: "10.6cm",
geometry: "ellipse",
fill: {
type: "gradient",
stops: [
{ position: 0, color: "FFFFFF" },
{ position: 100, color: "1565C0" },
],
path: "circle",
},
},
},
],
},
],
});
Multi-stop Gradient
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "15.9cm",
"height": "6.6cm",
"fill": {
"type": "gradient",
"stops": [
{ "position": 0, "color": "E53935" },
{ "position": 50, "color": "FF9800" },
{ "position": 100, "color": "FFEB3B" }
],
"angle": 90
}
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "15.9cm",
height: "6.6cm",
fill: {
type: "gradient",
stops: [
{ position: 0, color: "E53935" },
{ position: 50, color: "FF9800" },
{ position: 100, color: "FFEB3B" },
],
angle: 90,
},
},
},
],
},
],
});
Image Fill (Blip Fill)
The data field accepts raw bytes (Uint8Array, ArrayBuffer, Buffer) or a base64 data URL such as data:image/png;base64,....
import * as fs from "node:fs";
import { generatePresentation } from "@office-open/pptx";
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "15.9cm",
"height": "9.3cm",
"fill": {
"type": "blip",
"data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=",
"imageType": "png"
}
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "15.9cm",
height: "9.3cm",
fill: {
type: "blip",
data: new Uint8Array(fs.readFileSync("texture.png")),
imageType: "png",
},
},
},
],
},
],
});
No Fill (Transparent)
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "13.2cm",
"height": "6.6cm",
"fill": { "type": "none" },
"outline": { "color": "2E74B5", "width": 2 }
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "13.2cm",
height: "6.6cm",
fill: { type: "none" },
outline: { color: "2E74B5", width: 12700 },
},
},
],
},
],
});
Outline
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "13.2cm",
"height": "6.6cm",
"fill": { "type": "solid", "color": "E3F2FD" },
"outline": {
"color": "1565C0",
"width": "0.1cm",
"dashStyle": "solid"
}
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "13.2cm",
height: "6.6cm",
fill: { type: "solid", color: "E3F2FD" },
outline: {
color: "1565C0",
width: "336.0cm", // Width in EMU (12700 = 1pt)
dashStyle: "solid", // "solid" | "dash" | "dashDot" | "lgDash" | "sysDot" | "sysDash"
},
},
},
],
},
],
});
Effects
Use the effects property for shadows, glow, reflection, soft edge, and 3D effects:
Outer Shadow
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "5.3cm",
"height": "3.2cm",
"fill": "ED7D31",
"effects": {
"outerShadow": {
"blur": 50800,
"distance": 38100,
"direction": 5400000,
"color": "000000",
"alpha": 50
}
}
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "5.3cm",
height: "3.2cm",
fill: "ED7D31",
effects: {
outerShadow: {
blur: 50800, // Blur radius (EMU)
distance: 38100, // Offset distance (EMU)
direction: 5400000, // Angle (60000ths of a degree)
color: "000000",
alpha: 50, // Opacity percentage
},
},
},
},
],
},
],
});
Inner Shadow
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "5.3cm",
"height": "3.2cm",
"fill": "5B9BD5",
"effects": {
"innerShadow": {
"blur": 40000,
"distance": 30000,
"direction": 5400000,
"color": "000000",
"alpha": 40
}
}
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "5.3cm",
height: "3.2cm",
fill: "5B9BD5",
effects: {
innerShadow: {
blur: 40000,
distance: 30000,
direction: 5400000,
color: "000000",
alpha: 40,
},
},
},
},
],
},
],
});
Glow
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "5.3cm",
"height": "3.2cm",
"fill": "70AD47",
"effects": {
"glow": {
"radius": 152400,
"color": "92D050",
"alpha": 60
}
}
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "5.3cm",
height: "3.2cm",
fill: "70AD47",
effects: {
glow: {
radius: 152400, // Glow radius (EMU)
color: "92D050",
alpha: 60,
},
},
},
},
],
},
],
});
Reflection
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "5.3cm",
"height": "3.2cm",
"fill": "FFC000",
"effects": {
"reflection": {
"blurRadius": 6350,
"distance": 38100,
"direction": 5400000,
"startAlpha": 90,
"endAlpha": 0
}
}
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "5.3cm",
height: "3.2cm",
fill: "FFC000",
effects: {
reflection: {
blurRadius: 6350,
distance: 38100,
direction: 5400000,
startAlpha: 90, // Start opacity percentage
endAlpha: 0, // End opacity percentage
},
},
},
},
],
},
],
});
Soft Edge
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "5.3cm",
"height": "3.2cm",
"fill": "BF8F00",
"effects": {
"softEdge": { "radius": 50800 }
}
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "5.3cm",
height: "3.2cm",
fill: "BF8F00",
effects: {
softEdge: { radius: 50800 },
},
},
},
],
},
],
});
3D Rotation and Bevel
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "5.3cm",
"height": "4.0cm",
"fill": "FFC000",
"effects": {
"rotation3D": {
"x": "0.5cm",
"y": "0.8cm",
"z": 10,
"perspective": 500
},
"bevelTop": { "width": 8, "height": 8 },
"extrusionH": 50000,
"material": "plastic"
}
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "5.3cm",
height: "4.0cm",
fill: "FFC000",
effects: {
rotation3D: {
x: "0.5cm", // X rotation (degrees)
y: "0.8cm", // Y rotation (degrees)
z: 10, // Z rotation (degrees)
perspective: 500, // Perspective value
},
bevelTop: { width: 8, height: 8 },
extrusionH: 50000, // Extrusion height (EMU)
material: "plastic", // "plastic" | "metal" | "matte" | "flat"
},
},
},
],
},
],
});
Combined Effects
Multiple effects can be applied simultaneously:
{
"slides": [
{
"children": [
{
"shape": {
"x": "1.3cm",
"y": "1.3cm",
"width": "5.3cm",
"height": "3.2cm",
"fill": "7030A0",
"effects": {
"outerShadow": {
"blur": 40000,
"distance": 30000,
"direction": 2700000,
"color": "000000",
"alpha": 40
},
"glow": { "radius": 101600, "color": "B381E7", "alpha": 35 }
}
}
}
]
}
]
}
generatePresentation({
slides: [
{
children: [
{
shape: {
x: "1.3cm",
y: "1.3cm",
width: "5.3cm",
height: "3.2cm",
fill: "7030A0",
effects: {
outerShadow: {
blur: 40000,
distance: 30000,
direction: 2700000,
color: "000000",
alpha: 40,
},
glow: { radius: 101600, color: "B381E7", alpha: 35 },
},
},
},
],
},
],
});
Effects Options
| Property | Type | Description |
|---|---|---|
outerShadow | ShadowOptions | Outer drop shadow |
innerShadow | ShadowOptions | Inner shadow |
glow | GlowOptions | Glow effect |
reflection | ReflectionOptions | Reflection effect |
softEdge | SoftEdgeOptions | Soft edge effect |
rotation3D | Rotation3DOptions | 3D rotation |
bevelTop | PPTXBevelOptions | Top bevel |
bevelBottom | PPTXBevelOptions | Bottom bevel |
extrusionH | number | Extrusion height (EMU) |
material | string | Material type |
lighting | string | Lighting type |