w:highlight (Highlight Color)
Applies a highlight color to the background of the run text using a named color value.
Parent elements
Description
w:highlight applies a highlight colour to the background of the run text, simulating a highlighter pen effect. It is defined in ECMA-376 Part 1 §17.3.2.14.
Unlike w:shd (which sets a background via a shading pattern), w:highlight uses a fixed palette of named colours from ST_HighlightColor.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:val |
ST_HighlightColor |
black, blue, cyan, darkBlue, darkCyan, darkGray, darkGreen, darkMagenta, darkRed, darkYellow, green, lightGray, magenta, none, red, white, yellow |
The highlight colour. none removes highlighting. |
Examples
<w:rPr>
<w:highlight w:val="yellow"/>
</w:rPr>
new RunProperties(
new Highlight { Val = HighlightColorValues.Yellow });
Notes
- The colour palette is fixed; arbitrary RGB values are not supported. Use
w:shdfor custom background colours. w:val="none"explicitly removes highlight that might be inherited from a style.