code: def color(self, value):
          
          assert self._is_domain_set, \
              "Domain is not set. Use self.domain to set the domain."
  
          if self._ctype == 2:
              # if ordinal map the value and color
              try:
                  return self._colors[self._domain.index(value)]
              except ValueError:
                  raise ValueError(
                      "%s is not a valid input for ordinal type.\n" % str(value) +
                      "List of valid values are %s" % ";".join(map(str, self._domain))
                  )
  
          if value < self._domain[0]:
              return self._colors[0]
          if value > self._domain[-1]:
              return self._colors[-1]
  
          # find the index of the value in domain
          for count, d in enumerate(self._domain):
              if d <= value <= self._domain[count + 1]:
                  if self._ctype == 0:
                      return self._cal_color(value, count)
                  if self._ctype == 1:
                      return self._colors[count + 1]
docs: Return color for an input value.