def setColor(self, color):
        # Check that the color does not already exist
        exists = False
        for c in self._colorHistory:
            if color == c:
                exists = True
                break

        # If the color does not exist then add it
        if not exists:
            self._colorHistory.append(color)

        colorList = list(self._colorHistory)

        # Invert order of colors
        colorList.reverse()

        # Move the selected color to the front of the list
        colorList.insert(0, colorList.pop( colorList.index(color) ))

        # Create 2d color map
        colors = [([None] * self._columns) for _ in range(self._rows)]
        iterator = iter(colorList)

        for row in range(self._rows):
            for col in range(self._columns):
                try:
                    colors[row][col] = iterator.next()
                except __HOLE__:
                    colors[row][col] = Color.WHITE

        self._grid.setColorGrid(colors)
        self._grid.requestRepaint()
dataset/ETHPy150Open rwl/muntjac/muntjac/addon/colorpicker/color_picker_history.py/ColorPickerHistory.setColor