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 { Shape, Paragraph, TextRun } from "@office-open/pptx";

new Shape({
    x: 1,
    y: 1,
    width: 5,
    height: 2,
    fill: { type: "solid", color: "2E74B5" },
    text: "Blue shape",
    paragraphs: [
        new Paragraph({
            children: [new TextRun({ text: "Blue background", color: "FFFFFF", fontSize: 20 })],
        }),
    ],
});

Gradient Fill

Linear gradient with angle:

new Shape({
    x: 1,
    y: 1,
    width: 6,
    height: 3,
    fill: {
        type: "gradient",
        stops: [
            { position: 0, color: "0D47A1" },
            { position: 50, color: "1976D2" },
            { position: 100, color: "42A5F5" },
        ],
        angle: 45,
    },
});

Path gradient (radial):

new Shape({
    x: 1,
    y: 1,
    width: 5,
    height: 5,
    geometry: "ellipse",
    fill: {
        type: "gradient",
        stops: [
            { position: 0, color: "FFFFFF" },
            { position: 100, color: "1565C0" },
        ],
        path: "circle",
    },
});

No Fill (Transparent)

new Shape({
    x: 1,
    y: 1,
    width: 5,
    height: 2,
    fill: { type: "noFill" },
    outline: { color: "2E74B5", width: 2 },
    text: "Transparent shape with border",
});

Outline

new Shape({
    x: 1,
    y: 1,
    width: 5,
    height: 3,
    fill: { type: "solid", color: "E3F2FD" },
    outline: { color: "1565C0", width: 2 },
    text: "Bordered shape",
});

Color Scheme Tips

Define a consistent palette and reuse it:

const colors = {
    primary: "2E74B5",
    secondary: "70AD47",
    accent: "ED7D31",
    dark: "1F3864",
    light: "D6E4F0",
    white: "FFFFFF",
};

new Shape({
    fill: { type: "solid", color: colors.primary },
    paragraphs: [
        new Paragraph({
            children: [
                new TextRun({ text: "Title", color: colors.white, bold: true, fontSize: 24 }),
            ],
        }),
    ],
});

Background Styles

Apply background styling at the slide level:

import { Slide } from "@office-open/pptx";

// Solid background
new Slide({
    background: { type: "solid", color: "1F3864" },
    children: [],
});

// Gradient background
new Slide({
    background: {
        type: "gradient",
        stops: [
            { position: 0, color: "0D47A1" },
            { position: 100, color: "42A5F5" },
        ],
        angle: 135,
    },
    children: [],
});
Copyright © 2026