Last Updated: February 25, 2016
·
710
· samccone

Convert any CSS color to RGB

were you ever like dang.. i want to get the RGB color from ... anything

well now you can

function getRGB(color) {
  var elm = document.createElement('span');
  elm.style.color = color;
  document.body.appendChild(elm);
  return getComputedStyle(elm).color
}