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)
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)
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)
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)