docs: def getColor(value, default=None):
      """
      Convert to color value.
      This returns a Color object instance from a text bit.
      """
  
      if isinstance(value, Color):
          return value
      value = str(value).strip().lower()
      if value == "transparent" or value == "none":
          return default
      if value in COLOR_BY_NAME:
          return COLOR_BY_NAME[value]
      if value.startswith("#") and len(value) == 4:
          value = "#" + value[1] + value[1] + \
              value[2] + value[2] + value[3] + value[3]
      elif rgb_re.search(value):
          # e.g., value = "<css function: rgb(153, 51, 153)>", go figure:
          r, g, b = [int(x) for x in rgb_re.search(value).groups()]
          value = "#%02x%02x%02x" % (r, g, b)
      else:
          # Shrug
          pass
  
      return toColor(value, default)