Skip to content

Function: presetColorHex() ​

presetColorHex(name): string | null

Resolve an a:prstClr/@val preset colour name to its 6-hex RGB, or null when the name is not one of the 190 ST_PresetColorVal values.

Lenient about case for the same reason the rest of the read path is: the input is a file someone else wrote, and a producer that spelled Black has still said which colour it meant. A name that is not in the enumeration at all resolves to null rather than to a guess, so the caller reports "no colour" instead of painting an invented one.

Parameters ​

ParameterTypeDescription
namestring | nullthe raw attribute value, or null when the attribute is absent

Returns ​

string | null