def hex2rgb(hexcolor):
  """Convert a hex color to a (r, g, b) tuple equivilent."""
  hexcolor = hexcolor.strip('\n\r #')
  if len(hexcolor) != 6:
    raise ValueError('Input #%s not in #rrggbb format' % hexcolor)
  r, g, b = hexcolor[:2], hexcolor[2:4], hexcolor[4:]
  return [int(n, 16) for n in (r, g, b)]