<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_domain(self, values):
 """Set domain of the colors based on min and max of a list of values."""

        _flattenedList = sorted(flatten(values))
        self.domain = tuple(_flattenedList[0] if d == 'min' else d for d in self.domain)
        self.domain = tuple(_flattenedList[-1] if d == 'max' else d for d in self.domain)