code: function getRgbAColor(color, opacity) {
    const id = color + '&' + opacity;
    if (colorCache[id]) {
      return colorCache[id];
    }
  
    const div = document.createElement('div');
    div.style.background = color;
    document.body.appendChild(div);
    const computedColor = window.getComputedStyle(div).backgroundColor;
    document.body.removeChild(div);
  
    /* istanbul ignore if */
    if (!rgbReg.test(computedColor)) {
      return color;
    }
  
    return (colorCache[id] = `rgba(${
      extractRgbColor.exec(computedColor)[1]
    }, ${opacity})`);
  }
docs: Transform a common color int oa `rgbA` color