`w:val="none"` is a valid `ST_HighlightColor` value that Word writes when
a highlight is explicitly cleared from a run. It has no `WD_COLOR_INDEX`
member, so reading `Font.highlight_color` on such a run raised
`ValueError: WD_COLOR_INDEX has no XML mapping for 'none'` from
`BaseXmlEnum.from_xml()`, which aborts parsing of any document containing
the value.
`none` semantically means "not highlighted", which python-docx already
represents as `None` (the value returned when no `w:highlight` element is
present), and which the `highlight_val` setter writes by removing the
element. Map the explicit `none` value to `None` in the getter to match.
`none` is the only `ST_HighlightColor` value absent from `WD_COLOR_INDEX`,
so this closes the gap completely.
Fixes #1559.
Problem
Reading Font.highlight_color on a run with <w:highlight w:val="none"/> raises ValueError: WD_COLOR_INDEX has no XML mapping for 'none'. none is a valid ST_HighlightColor value that Word writes when a highlight is explicitly cleared. Because the error fires during parsing, it aborts processing of any document containing the value.
Fix
none means "not highlighted" — the same state python-docx already represents as None (returned when no w:highlight element is present, and what the highlight_val setter writes by removing the element). The getter now maps the explicit none value to None.
none is the only ST_HighlightColor value absent from WD_COLOR_INDEX, so this closes the gap without introducing an enum member that would collide on MS-API value 0 with AUTO.
Changes
Verification