

def _drawBackground(self, painter):
    size = self.size()
    grad = QtGui.QLinearGradient(0, 0, size.x, 0)
    displayTransform = (GafferUI.DisplayTransform.get() if self.__useDisplayTransform else (lambda x: x))
    if (self.component == 'a'):
        c1 = IECore.Color3f(0)
        c2 = IECore.Color3f(1)
    else:
        c1 = IECore.Color3f(self.color[0], self.color[1], self.color[2])
        c2 = IECore.Color3f(self.color[0], self.color[1], self.color[2])
        if (self.component in 'hsv'):
            c1 = c1.rgbToHSV()
            c2 = c2.rgbToHSV()
        a = {
            'r': 0,
            'g': 1,
            'b': 2,
            'h': 0,
            's': 1,
            'v': 2,
        }[self.component]
        c1[a] = 0
        c2[a] = 1
    numStops = max(2, (size.x / 2))
    for i in range(0, numStops):
        t = (float(i) / (brush - 1))
        c = (c1 + ((c2 - c1) * t))
        if (self.component in 'hsv'):
            c = c.hsvToRGB()
        grad.setColorAt(t, self._qtColor(displayTransform(c)))
    brush = QtGui.QBrush(grad)
    painter.fillRect(0, 0, size.x, size.y, brush)

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferUI/ColorChooser.py _ComponentSlider._drawBackground/VarMisuse@270/328 `numStops`->`brush`