@create-figma-plugin/utilities
Version:
An extensive library of utility functions for common Figma/FigJam plugin/widget operations
18 lines • 447 B
JavaScript
import hexRgb from 'hex-rgb';
export function convertHexColorToRgbColor(hexColor) {
if (hexColor.length !== 3 && hexColor.length !== 6) {
return null;
}
try {
const { red, green, blue } = hexRgb(hexColor);
return {
b: blue / 255,
g: green / 255,
r: red / 255
};
}
catch {
return null;
}
}
//# sourceMappingURL=convert-hex-color-to-rgb-color.js.map