@wordpress/block-editor
Version:
37 lines (33 loc) • 770 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getValuesFromColors = getValuesFromColors;
var _colord = require("colord");
/**
* External dependencies
*/
/**
* Convert a list of colors to an object of R, G, and B values.
*
* @param {string[]} colors Array of RBG color strings.
*
* @return {Object} R, G, and B values.
*/
function getValuesFromColors(colors = []) {
const values = {
r: [],
g: [],
b: [],
a: []
};
colors.forEach(color => {
const rgbColor = (0, _colord.colord)(color).toRgb();
values.r.push(rgbColor.r / 255);
values.g.push(rgbColor.g / 255);
values.b.push(rgbColor.b / 255);
values.a.push(rgbColor.a);
});
return values;
}
//# sourceMappingURL=utils.js.map