UNPKG

kobalt

Version:

A cli to generate a theme from figma projects.

16 lines (15 loc) 459 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.convertToHex = void 0; const convertToHex = ({ r, g, b, a }) => { const base = 256; const color = "#" + ((a << 24) + ((r * base) << 16) + ((g * base) << 8) + b * base) .toString(16) .slice(1); if (color.length > 7) { return color.slice(0, 7); } return color; }; exports.convertToHex = convertToHex;