Function: rgbToHex()
rgbToHex(
rgb
,includeAlpha
?):string
Converts RGB values to a hex color code.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
rgb | RGB | undefined | An object with r, g, and b properties, and an optional a property. |
includeAlpha ? | boolean | false | Whether to include the alpha channel in the hex string. |
Returns
string
The hex color code.
Throws
If the input is not a valid RGB object or if RGB values are out of range.
Defined in
conversions/components/hex.ts:10