def fun(b, e, s, i): b = [float(x) for x in b.split(',')] e = [float(x) for x in e.split(',')] u = float(i) / (float(s) - 1.0) # Use QtGui.QColor as easy converter between rgb and hsv color_b = QtGui.QColor(int(b[0] * 255), int(b[1] * 255), int(b[2] * 255)) color_e = QtGui.QColor(int(e[0] * 255), int(e[1] * 255), int(e[2] * 255)) b_hsv = [color_b.hueF(), color_b.saturationF(), color_b.valueF()] e_hsv = [color_e.hueF(), color_e.saturationF(), color_e.valueF()] [new_h, new_s, new_v] = [b_hsv[i] + u * (e_hsv[i] - b_hsv[i]) for i in [0,1,2]] new_color = QtGui.QColor() new_color.setHsvF(new_h, new_s, new_v) return Color.to_string(new_color.redF(), new_color.greenF(), new_color.blueF())
def get_value(self): return Color.to_string(self.qcolor.redF(), self.qcolor.greenF(), self.qcolor.blueF())
def fun(b, e, s, i): b = [float(x) for x in b.split(',')] e = [float(x) for x in e.split(',')] u = float(i) / (float(s) - 1.0) [r,g,b] = [b[i] + u * (e[i] - b[i]) for i in [0,1,2]] return Color.to_string(r, g, b)