w:shd (Shading)

Applies a background fill color and optional pattern to a paragraph, run, or table cell.

Parent elements

Description

w:shd applies a background fill (shading) to a paragraph, run, or table cell. It is defined in ECMA-376 Part 1 §17.3.5 (paragraphs/runs) and §17.4.33 (table cells).

The background is composed of a fill colour (w:fill) and an optional pattern colour (w:color) combined via a shading pattern (w:val). For a solid fill with no pattern, use w:val="clear" and set w:fill to the desired colour.

Attributes

Attribute Type Possible Values Description
w:val ST_Shd clear (solid fill), nil (no shading), solid, horzStripe, vertStripe, diagStripe, reverseDiagStripe, thinHorzStripe, thinVertStripe, pct5, pct10, … pct90, pct95 Shading pattern. clear with w:fill gives a plain background colour.
w:color ST_HexColorAuto 6-digit hex RGB or auto Foreground (pattern) colour.
w:fill ST_HexColorAuto 6-digit hex RGB or auto Background fill colour.
w:themeColor ST_ThemeColor Theme colour slot names (e.g. accent1) Theme colour for the pattern foreground.
w:themeFill ST_ThemeColor Theme colour slot names Theme colour for the background fill.
w:themeFillTint ST_UcharHexNumber 00FF Lightens the theme fill colour.
w:themeFillShade ST_UcharHexNumber 00FF Darkens the theme fill colour.

Examples

Yellow background on a paragraph

<w:pPr>
  <w:shd w:val="clear" w:color="auto" w:fill="FFFF00"/>
</w:pPr>