@coreui/ajax
Version:
Open Source Bootstrap Admin Template
18 lines (14 loc) • 438 B
JavaScript
export default {
//convert Hex to RGBA
convertHex(hex, opacity) {
hex = hex.replace('#', '');
let r = parseInt(hex.substring(0, 2), 16);
let g = parseInt(hex.substring(2, 4), 16);
let b = parseInt(hex.substring(4, 6), 16);
let result = 'rgba(' + r + ',' + g + ',' + b + ',' + opacity / 100 + ')';
return result;
},
random(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}
}