lib-colors
Version:
Simple node.js library for work with colors
12 lines (11 loc) • 393 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.rgbToString = rgbToString;
const alpha_is_set_helper_1 = require("../../helpers/alpha_is_set.helper");
function rgbToString(rgb) {
const { r, g, b, a } = { ...rgb };
if ((0, alpha_is_set_helper_1.alphaIsSet)(a)) {
return `rgba(${r},${g},${b},${a})`;
}
return `rgb(${r},${g},${b})`;
}