code: def hex_2_rgb(self, color):
          
          if not self.RE_HEX.match(color):
              color = "#FFF"
          if len(color) == 7:
              return (int(color[i : i + 2], 16) / 255 for i in [1, 3, 5])
          return (int(c, 16) / 15 for c in color)
docs: convert a hex color to rgb