@antv/g2plot
Version:
G2 Plot, a market of plots built with the Grammar of Graphics'
20 lines • 503 B
JavaScript
export function rgb2arr(str) {
var arr = [];
arr.push(parseInt(str.substr(1, 2), 16));
arr.push(parseInt(str.substr(3, 2), 16));
arr.push(parseInt(str.substr(5, 2), 16));
return arr;
}
export function toHex(value) {
var v;
v = Math.round(value);
v = v.toString(16);
if (v.length === 1) {
v = "0" + value;
}
return v;
}
export function arr2rgb(arr) {
return "#" + (toHex(arr[0]) + toHex(arr[1]) + toHex(arr[2]));
}
//# sourceMappingURL=color.js.map