Skip to content
Office Open

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

ts
import { generatePresentation } from "@office-open/pptx";
JSON
{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "10.6cm",
            "height": "6.6cm",
            "properties": {
              "fill": {
                "type": "solid",
                "color": "2E74B5"
              }
            }
          }
        }
      ]
    }
  ]
}

Short form — pass a color string directly:

JSON
{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "10.6cm",
            "height": "6.6cm",
            "properties": {
              "fill": "2E74B5"
            }
          }
        }
      ]
    }
  ]
}

#Gradient Fill

#Linear Gradient (with angle)

JSON
{
  "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": 100,
                    "color": "42A5F5"
                  }
                ],
                "angle": 45
              }
            }
          }
        }
      ]
    }
  ]
}

#Radial Gradient (with path)

JSON
{
  "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"
              }
            }
          }
        }
      ]
    }
  ]
}

#Multi-stop Gradient

JSON
{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "15.9cm",
            "height": "6.6cm",
            "properties": {
              "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,....

ts
import * as fs from "node:fs";
import { generatePresentation } from "@office-open/pptx";
JSON
{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "15.9cm",
            "height": "9.3cm",
            "properties": {
              "fill": {
                "type": "blip",
                "data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=",
                "imageType": "png"
              }
            }
          }
        }
      ]
    }
  ]
}

#No Fill (Transparent)

JSON
{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "13.2cm",
            "height": "6.6cm",
            "properties": {
              "fill": {
                "type": "none"
              },
              "outline": {
                "color": "2E74B5",
                "width": 2
              }
            }
          }
        }
      ]
    }
  ]
}

#Outline

JSON
{
  "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": "0.1cm",
                "dash": "solid"
              }
            }
          }
        }
      ]
    }
  ]
}

#Effects

Use the effects property for shadows, glow, reflection, soft edge, and 3D effects:

#Outer Shadow

JSON
{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "5.3cm",
            "height": "3.2cm",
            "properties": {
              "fill": "ED7D31",
              "effects": {
                "outerShadow": {
                  "blurRadius": 50800,
                  "distance": 38100,
                  "direction": 90,
                  "color": {
                    "value": "000000",
                    "transforms": {
                      "alpha": 50
                    }
                  }
                }
              }
            }
          }
        }
      ]
    }
  ]
}

#Inner Shadow

JSON
{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "5.3cm",
            "height": "3.2cm",
            "properties": {
              "fill": "5B9BD5",
              "effects": {
                "innerShadow": {
                  "blurRadius": 40000,
                  "distance": 30000,
                  "direction": 90,
                  "color": {
                    "value": "000000",
                    "transforms": {
                      "alpha": 40
                    }
                  }
                }
              }
            }
          }
        }
      ]
    }
  ]
}

#Glow

JSON
{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "5.3cm",
            "height": "3.2cm",
            "properties": {
              "fill": "70AD47",
              "effects": {
                "glow": {
                  "radius": 152400,
                  "color": {
                    "value": "92D050",
                    "transforms": {
                      "alpha": 60
                    }
                  }
                }
              }
            }
          }
        }
      ]
    }
  ]
}

#Reflection

JSON
{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "5.3cm",
            "height": "3.2cm",
            "properties": {
              "fill": "FFC000",
              "effects": {
                "reflection": {
                  "blurRadius": 6350,
                  "distance": 38100,
                  "direction": 90,
                  "startAlpha": 90,
                  "endAlpha": 0
                }
              }
            }
          }
        }
      ]
    }
  ]
}

#Soft Edge

JSON
{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "5.3cm",
            "height": "3.2cm",
            "properties": {
              "fill": "BF8F00",
              "effects": {
                "softEdge": 50800
              }
            }
          }
        }
      ]
    }
  ]
}

#3D Rotation and Bevel

3D is split across two shape properties — not under effects:

  • scene3d (a:scene3d) — the 3D scene: camera and lightRig (and optional backdrop). Camera rotation is a sphere coordinate { lat, lon, rev } in degrees; lightRig carries a rig and a direction.
  • shape3d (a:sp3d) — the 3D shape body: bevelT/bevelB (top/bottom bevels), extrusionH, contourW, z, and prstMaterial.
JSON
{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "5.3cm",
            "height": "4.0cm",
            "properties": {
              "fill": "FFC000",
              "scene3d": {
                "camera": {
                  "preset": "perspectiveFront",
                  "fov": 30,
                  "rotation": {
                    "lat": 0,
                    "lon": 0,
                    "rev": 10
                  }
                },
                "lightRig": {
                  "rig": "threePt",
                  "direction": "top"
                }
              },
              "shape3d": {
                "bevelT": {
                  "w": 76200,
                  "h": 76200,
                  "prst": "circle"
                },
                "extrusionH": 50000,
                "prstMaterial": "plastic"
              }
            }
          }
        }
      ]
    }
  ]
}

#Combined Effects

Multiple effects can be applied simultaneously:

JSON
{
  "slides": [
    {
      "children": [
        {
          "shape": {
            "x": "1.3cm",
            "y": "1.3cm",
            "width": "5.3cm",
            "height": "3.2cm",
            "properties": {
              "fill": "7030A0",
              "effects": {
                "outerShadow": {
                  "blurRadius": 40000,
                  "distance": 30000,
                  "direction": 45,
                  "color": {
                    "value": "000000",
                    "transforms": {
                      "alpha": 40
                    }
                  }
                },
                "glow": {
                  "radius": 101600,
                  "color": {
                    "value": "B381E7",
                    "transforms": {
                      "alpha": 35
                    }
                  }
                }
              }
            }
          }
        }
      ]
    }
  ]
}

#Effects Options

effects carries flat 2D effects only (EffectListOptions). 3D lives on the shape directly via scene3d and shape3d.

PropertyTypeDescription
effects.blurBlurEffectOptionsBlur effect
effects.glowGlowEffectOptionsGlow effect (radius + color)
effects.innerShadowInnerShadowEffectOptionsInner shadow (blurRadius, distance, direction in degrees, color)
effects.outerShadowOuterShadowEffectOptionsOuter drop shadow (blurRadius, distance, direction in degrees, color)
effects.reflectionReflectionEffectOptions | trueReflection (blurRadius, distance, direction in degrees, startAlpha, endAlpha)
effects.softEdgenumber | UniversalMeasureSoft edge radius — scalar (EMU or UniversalMeasure)
scene3dScene3DOptions3D scene — camera and lightRig (angles in degrees)
shape3dShape3DOptions3D shape body — bevelT/bevelB, extrusionH, contourW, z, prstMaterial

Shadow and glow color is a SolidFillOptions ({ value, transforms }); pass opacity through color.transforms.alpha (integer percent), not a top-level alpha.