NLdoc.Conversion.Reader.Docx.AST.RunProperties.Highlight (NLdoc.Conversion.Reader.Docx v1.5.5)
View SourceNormalizes DOCX w:highlight values (ECMA-376 ST_HighlightColor) to an
internal representation and exposes their RGB hex values.
This module is responsible for:
- Parsing raw
w:valstrings from run properties (e.g."yellow","darkBlue","none") to internal atoms viat/0usingparse/1. - Converting those atoms to lowercase RGB hex strings (or
nilfor:none) viato_hex/1, for use in downstream rendering or style normalization.
Invalid or unknown highlight values are mapped to nil by parse/1, allowing
callers to treat them as “no highlight” or handle them explicitly upstream.
Summary
Functions
Parses an ST_HighlightColor string value to its internal atom representation.
Returns the lowercase hex RGB value for a highlight atom, or nil for :none.
Types
Functions
Parses an ST_HighlightColor string value to its internal atom representation.
Examples
iex> alias NLdoc.Conversion.Reader.Docx.AST.RunProperties.Highlight
iex> Highlight.parse("yellow")
:yellow
iex> Highlight.parse("not-a-color")
nil
Returns the lowercase hex RGB value for a highlight atom, or nil for :none.
Examples
iex> alias NLdoc.Conversion.Reader.Docx.AST.RunProperties.Highlight
iex> Highlight.to_hex(:none)
nil
iex> Highlight.to_hex(:black)
"#000000"
iex> Highlight.to_hex(:blue)
"#0000ff"
iex> Highlight.to_hex(:cyan)
"#00ffff"
iex> Highlight.to_hex(:green)
"#00ff00"
iex> Highlight.to_hex(:magenta)
"#ff00ff"
iex> Highlight.to_hex(:red)
"#ff0000"
iex> Highlight.to_hex(:yellow)
"#ffff00"
iex> Highlight.to_hex(:white)
"#ffffff"
iex> Highlight.to_hex(:dark_blue)
"#000080"
iex> Highlight.to_hex(:dark_cyan)
"#008080"
iex> Highlight.to_hex(:dark_green)
"#008000"
iex> Highlight.to_hex(:dark_magenta)
"#800080"
iex> Highlight.to_hex(:dark_red)
"#800000"
iex> Highlight.to_hex(:dark_yellow)
"#808000"
iex> Highlight.to_hex(:dark_gray)
"#808080"
iex> Highlight.to_hex(:light_gray)
"#c0c0c0"