I saw this gist to change RGB color to RGBA, but JS Math does not have a range method. Is there any way to convert the range method here?
function rgba(hex, opacity) {
    var colours = hex.regex(/#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})/i).map(function(val) {
        return Math.range(0, parseInt(val, 16), 255);
    }).join(",");
    if (opacity === undefined) {
        return "rgb(" + colours + ")";
    }
    return "rgba(" + colours + "," + opacity + ")";
}
Found this here: https://gist.github.com/Rycochet/8597336
 
     
    