Validates and normalizes a hexadecimal color value.
Accepts either "auto" or a 6-character RGB hex value (with or without # prefix). The # prefix is commonly used but technically invalid in OOXML, so it is stripped for strict compliance.
Reference: ST_HexColor in OOXML specification
The color value to validate ("auto" or hex color)
The normalized color value
Error if the hex color is invalid
const color1 = hexColorValue("auto"); // Returns "auto"const color2 = hexColorValue("FF0000"); // Returns "FF0000"const color3 = hexColorValue("#00FF00"); // Returns "00FF00" (# stripped) Copy
const color1 = hexColorValue("auto"); // Returns "auto"const color2 = hexColorValue("FF0000"); // Returns "FF0000"const color3 = hexColorValue("#00FF00"); // Returns "00FF00" (# stripped)
Validates and normalizes a hexadecimal color value.
Accepts either "auto" or a 6-character RGB hex value (with or without # prefix). The # prefix is commonly used but technically invalid in OOXML, so it is stripped for strict compliance.
Reference: ST_HexColor in OOXML specification