discord-card-canvas
Version:
👾 Simple creating cards using canvas. Welcome, Rank, Info and so on.
13 lines (12 loc) • 446 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.rgbToHex = void 0;
const rgbToHex = (rgb) => {
let matchColors = /(rgb|rgba)\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})/;
const match = matchColors.exec(rgb);
if (match !== null) {
return '#' + ((1 << 24) | (match[2] << 16) | (match[3] << 8) | match[4]).toString(16).slice(1);
}
throw new Error('Bad Rgb');
};
exports.rgbToHex = rgbToHex;