function getColorInHex (colorString) {
  var canvas = document.createElement("canvas");
  var context = canvas.getContext("2d");
  context.fillStyle = colorString; // When rgb is in string it is transparent i.e rgba(0,0,0,0)
  // but it does not know to show the hex value of that.
  // We help it by using hex alpha values
  // https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color

  return /rgb/.test(context.fillStyle) ? "transparent" : context.fillStyle.toUpperCase();
}

export { getColorInHex as default };
