rgbToHex
Converts an RGB(A) color into a hex color string.
r/g/b are clamped to 0-255 and rounded to the nearest integer before
formatting. The alpha channel is only appended (as #rrggbbaa) when it is
below 1 — fully opaque colors format as the plain 6-digit #rrggbb.
Available since next
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
color | RgbColor | The color to convert. a defaults to 1 (opaque) when omitted. |
Returns
Section titled “Returns”string — A lowercase hex color string
Examples
Section titled “Examples”Format an opaque color as hex
Section titled “Format an opaque color as hex”Alpha defaults to 1 (opaque) and is omitted from the output.
Include alpha when the color is translucent
Section titled “Include alpha when the color is translucent”A non-opaque color formats as an 8-digit #rrggbbaa string.
