def setColor(self, color, emit=True):
if isinstance(color, (str, bytes)):
self.color = QtGui.QColor(color)
else:
self.color = color
self.update()
if emit:
self.colorChanged.emit(self.color)