我的代码(o先前已定义):
colors = document.getElementsByClassName('active')[0].style.backgroundColor.substring(colorString.indexOf('(') + 1, colorString.lastIndexOf(')')).split(/,\s*/);
red = colors[0];
green = colors[1];
blue = colors[2];
canvas.strokeStyle = "rgba("+red+","+green+","+blue+","+o+")";