function parseRGBA(rgbStr) {
  var bits = RGBA_RE.exec(rgbStr);
  if (!bits) return null;
  var r = parseInt(bits[1], 10),
      g = parseInt(bits[2], 10),
      b = parseInt(bits[3], 10);
  if (bits[4]) {
    return {r: r, g: g, b: b, a: parseFloat(bits[4])};
  } else {
    return {r: r, g: g, b: b};
  }
}
function parseRGBA(rgbStr) {
  var bits = RGBA_RE.exec(rgbStr);
  if (!bits) return null;
  var r = parseInt(bits[1], 10),
      g = parseInt(bits[2], 10),
      b = parseInt(bits[3], 10);
  if (bits[4]) {
    return {r: r, g: g, b: b, a: parseFloat(bits[4])};
  } else {
    return {r: r, g: g, b: b};
  }
}
function parseRGBA ( rgbStr ) { var bits = RGBA_RE . exec ( rgbStr ) ; if ( ! bits ) return null ; var r = parseInt ( bits [ 1 ] , 10 ) , g = parseInt ( bits [ 2 ] , 10 ) , b = parseInt ( bits [ 3 ] , 10 ) ; if ( bits [ 4 ] ) { return { r : r , g : g , b : b , a : parseFloat ( bits [ 4 ] ) } ; } else { return { r : r , g : g , b : b } ; } }
Helper for toRGB_ which parses strings of the form:
rgb(123, 45, 67)
rgba(123, 45, 67, 0.5)
@return parsed {r,g,b,a?} tuple or null.
Helper for toRGB_ which parses strings of the form : rgb ( 123 45 67 ) rgba ( 123 45 67 0 . 5 )