Converts RGB values to a hex color code.
An object with r, g, and b properties, and an optional a property.
Optional
Whether to include the alpha channel in the hex string.
The hex color code.
If the input is not a valid RGB object or if RGB values are out of range.
Converts RGB values to a hex color code.