mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 13:43:03 -05:00
7 lines
265 B
TypeScript
7 lines
265 B
TypeScript
export const rgbToHex = (color: RGB) => {
|
|
const r = Math.round(255 * color.r);
|
|
const g = Math.round(255 * color.g);
|
|
const b = Math.round(255 * color.b);
|
|
const rgb = (r << 16) | (g << 8) | (b << 0);
|
|
return '#' + (0x1000000 + rgb).toString(16).slice(1);
|
|
};
|