a:pattFill (Pattern Fill)

Specifies a pattern fill using a repeating geometric pattern with foreground and background colors.

Parent elements

Child elements

Description

\:pattFill\ is the DrawingML pattern fill element that applies a repeating geometric pattern to shapes, lines, and grouped shapes. It is defined in ECMA-376 Part 1 §20.1.4.7.

Pattern fills create distinctive textured appearances using predefined geometric patterns. Each pattern consists of:

  • Foreground Color (\:fgClr): Color of the pattern elements (lines, dots, crosses)
  • Background Color (\:bgClr): Color filling the space between pattern elements
  • Pattern Type (prst attribute): Predefined geometric shape (horizontal lines, diagonal hatches, polka dots, etc.)

Pattern fills are valuable for:

  • Creating distinctive hatch patterns in diagrams and charts
  • Distinguishing areas without relying solely on color variation
  • Improving accessibility for colorblind users (pattern + color combination)
  • Creating texture effects for professional, polished documents
  • Providing print-friendly alternatives to gradients
  • Creating vintage or retro design effects

Pattern fills are lighter weight than gradients and render consistently across all Office applications.

Attributes

Attribute Type Range/Values Default Description
\prst\ \ST_PatternType\ ltHorz, ltVert, ltDnDiag, ltUpDiag, dkHorz, dkVert, dkDnDiag, dkUpDiag, wdDnDiag, wdUpDiag, dnDiag, upDiag, and 20+ more (required) Pattern type from ECMA-376 Part 1 §20.1.10.40.

Content Model

\:pattFill\ contains exactly:

  1. One foreground color element (\:fgClr)
  2. One background color element (\:bgClr)

Pattern type specified via \prst\ attribute; no pattern child element.

Child Elements Table

Element Occurrence Purpose
\:fgClr\ 1 Foreground color – color of pattern lines/shapes.
\:bgClr\ 1 Background color – color filling space between patterns.

Examples

Light Horizontal Lines Pattern

<a:spPr>
  <a:pattFill prst=\"ltHorz\">
    <a:fgClr>
      <a:srgbClr val=\"0070C0\"/>
    </a:fgClr>
    <a:bgClr>
      <a:srgbClr val=\"FFFFFF\"/>
    </a:bgClr>
  </a:pattFill>
</a:spPr>

Diagonal Crosshatch Pattern

<a:pattFill prst=\"wdUpDiag\">
  <a:fgClr>
    <a:srgbClr val=\"FF0000\"/>
  </a:fgClr>
  <a:bgClr>
    <a:srgbClr val=\"FFFF00\"/>
  </a:bgClr>
</a:pattFill>

Dark Vertical Lines with Scheme Colors

<a:pattFill prst=\"dkVert\">
  <a:fgClr>
    <a:schemeClr val=\"accent1\"/>
  </a:fgClr>
  <a:bgClr>
    <a:schemeClr val=\"lt1\"/>
  </a:bgClr>
</a:pattFill>

Small Confetti Pattern (Random dots)

<a:pattFill prst=\"smConfetti\">
  <a:fgClr>
    <a:srgbClr val=\"4472C4\">
      <a:alpha val=\"80000\"/>
    </a:srgbClr>
  </a:fgClr>
  <a:bgClr>
    <a:srgbClr val=\"E7E6E6\"/>
  </a:bgClr>
</a:pattFill>

Polka Dots (Checkerboard) Pattern

<a:pattFill prst=\"prcChecker\">
  <a:fgClr>
    <a:srgbClr val=\"000000\"/>
  </a:fgClr>
  <a:bgClr>
    <a:srgbClr val=\"FFFFFF\"/>
  </a:bgClr>
</a:pattFill>

Reference Tables

Light Patterns (ltXxx)

Pattern Value Description
ltHorz Light horizontal lines
ltVert Light vertical lines
ltDnDiag Light downward diagonal
ltUpDiag Light upward diagonal
ltDnDiag Light down-diagonal cross
ltHorz Light horizontal cross

Dark Patterns (dkXxx)

Pattern Value Description
dkHorz Dark horizontal lines
dkVert Dark vertical lines
dkDnDiag Dark downward diagonal
dkUpDiag Dark upward diagonal

Wide Patterns (wdXxx)

Pattern Value Description
wdDnDiag Wide downward diagonal
wdUpDiag Wide upward diagonal
wdHorz Wide horizontal cross
wdVert Wide vertical cross

Notes

Element Relationships

  • Parents: Shape properties (\:spPr), group properties (\:grpSpPr), line properties (\:ln)
  • Fill Priority: Only one fill type allowed per container; first defined fill is applied
  • Children: Exactly two color elements required – foreground (\:fgClr) and background (\:bgClr)
  • Pattern Type: Specified via \prst\ attribute, not as child element

Implementation Details

  • Color Types: Foreground and background support all color types (RGB, scheme, system, HSL, etc.)
  • Accessibility: Pattern + color combinations improve readability for colorblind users
  • Print Rendering: Patterns render consistently in print, unlike gradients which may appear banded
  • Theme Colors: Using scheme colors enables automatic theme switching across documents
  • Performance: Pattern fills are lightweight and render quickly even in large documents
  • Compatibility: All Office applications support standard patterns consistently
  • Pattern Exhaustiveness: 48+ patterns available covering lines, grids, dots, chevrons, waves
  • Foreground/Background Order: XML order matters – foreground before background
  • Pattern Density: Light patterns (~25% coverage), dark (~75%), wide (~50%)