ColorSpec¶
Namespace Nfty.Core.Imaging in assembly Nfty.Ticket.
Parses the prefixed color specs an author writes. The prefix is REQUIRED — a missing or unknown one is an error rather than a guess, because guessing between hex: and hsv: silently produces the wrong art.
Methods¶
Format(RgbColor)¶
Writes a color back out as a spec ColorSpec.Parse() reads — always the hex:rrggbb form.
Always hex because it is the one form that survives the round trip exactly: hsv and hsl resolve through 8-bit RGB and back with rounding at both ends, so formatting a color as hsv: and re-parsing it can land a channel off by one. Lower-case and invariant, so the same color produces the same six characters on every machine.
Parameters
color(RgbColor) - The color to write.
Returns. A spec such as hex:d6249f.
Parse(string)¶
Parses a spec such as hex:d6249f or hsv:322,83,84.
Parameters
spec(string) - The prefixed spec.
Returns. The color.
Exceptions
FormatException- The prefix is missing, unknown, or the body is malformed.