Writes a colour back as a string the renderer accepts.
Hex ordinarily, rgba() once alpha is involved. A colour outside sRGB
becomes color(srgb …), which carries the extended values verbatim and
reads back exactly — hex has no room for a channel above 255 or below 0, and
clamping instead would substitute a duller colour without saying so.
Out of gamut is fine and NaN is not: the first is a colour this cannot
write in hex, and the second is not a colour.
Writes a colour back as a string the renderer accepts.
Hex ordinarily,
rgba()once alpha is involved. A colour outside sRGB becomescolor(srgb …), which carries the extended values verbatim and reads back exactly — hex has no room for a channel above 255 or below 0, and clamping instead would substitute a duller colour without saying so.Out of gamut is fine and
NaNis not: the first is a colour this cannot write in hex, and the second is not a colour.