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",
            "fill": { "type": "solid", "color": "2E74B5" },
            "textBody": {
              "children": [
                {
                  "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",
            "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",
            "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",
            "fill": { "type": "none" },
            "outline": { "color": "2E74B5", "width": 2 }
          }
        }
      ]
    }
  ]
}

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": 2 }
          }
        }
      ]
    }
  ]
}

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",
            fill: { type: "solid", color: colors.primary },
            textBody: {
              children: [
                {
                  paragraph: {
                    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": {
          "type": "gradient",
          "stops": [
            { "position": 0, "color": "0D47A1" },
            { "position": 100, "color": "42A5F5" }
          ],
          "angle": 135
        }
      },
      "children": []
    }
  ]
}
Copyright © 2026