(rgba: RgbaColor)
| 41 | |
| 42 | /** Converts RGBA object to Hex6 or (if it has alpha channel) Hex8 string */ |
| 43 | export const rgbaToHex = (rgba: RgbaColor): string => { |
| 44 | const { r, g, b, a } = roundRgba(rgba); |
| 45 | const alphaHex = a < 1 ? format(round(a * 255)) : ""; |
| 46 | return "#" + format(r) + format(g) + format(b) + alphaHex; |
| 47 | }; |