function fixColors(str) {
    return str.replace(rxColor6, makeRGBA).replace(rxColor3, function ($0, r, g, b) {
        return makeRGBA($0, r + r, g + g, b + b);
    }).replace(rxColorName, function ($0, $1, $2) {
        if (ColorNames[$2]) {
            return ($1 ? $1 : "rgba(") + ColorNames[$2] + ($1 ? "" : ",1)");
        }
        return $0;
    }).replace(rxRGB, function ($0, $1, $2) {
        return "rgba(" + ($2.replace(rxSpaces, "") + ($1 ? "" : ",1")) + ")";
    });
}
Replace any css colour name with its rgba() value. It is possible to use
the name within an "rgba(blue, 0.4)" string this way.