예제 #1
0
    def lighten(color: QtGui.QColor, amount: float=0.1):
        h, s, l, a = color.getHslF()
        lightness = amount + l
        if lightness > 1:
            lightness = 1

        return QtGui.QColor.fromHslF(h, s, lightness, a)
예제 #2
0
 def transparentize(color: QtGui.QColor, amount: float):
     h, s, l, a = color.getHslF()
     alpha = a - amount if a - amount > 0 else 0
     return QtGui.QColor.fromHslF(h, s, l, alpha)
예제 #3
0
 def desaturate(color: QtGui.QColor, amount: float=0.1):
     h, s, l, a = color.getHslF()
     saturation = s - amount if s - amount > 0 else 0
     return QtGui.QColor.fromHslF(h, saturation, l, a)
예제 #4
0
 def darken(color: QtGui.QColor, amount: float=0.1):
     h, s, l, a = color.getHslF()
     lightness = l - amount if l-amount > 0 else 0
     return QtGui.QColor.fromHslF(h, s, lightness, a)