def add_color_to_palette(self):
if (self.curr_palette_string.get() == ""):
self.palette = [] # this is in case the default palette has already been used in a previous build
color = tkColorChooser.askcolor()
dprint("New color added to palette", color)
rgb_color = color[0]
hsv_color = colorsys.rgb_to_hsv(rgb_color[0]/255.0, rgb_color[1]/255.0, rgb_color[2]/255.0)
hsv = {"hue": int(hsv_color[0]*360), "saturation": int(hsv_color[1]*100), "brightness": int(hsv_color[2]*100)}
self.palette.append(hsv)
self.curr_palette_string.set(self.curr_palette_string.get() + json.dumps(hsv) + '\n')
评论列表
文章目录