Beispiel #1
0
 def set_strips(self, hex_string):
     h, s, l = color.to_hsl(color.to_rgb(hex_string))
     # Since the hue color strip is using preset color shifts it is reversed with 0 on the right and 360 on the left
     # We therefore need to use the complement of the fraction 1 - f
     self.hue.set(1 - h / 360)
     self.sat.set(s / 100)
     self.lum.set(l / 100)
Beispiel #2
0
 def __init__(self, master=None, starting_color=None, **cnf):
     super().__init__(master, **cnf)
     shifts = [
         *[(255, 0, i) for i in range(256)],  # Magenta shift
         *[(255 - i, 0, 255) for i in range(256)],  # Blue shift
         *[(0, i, 255) for i in range(256)],  # Cyan shift
         *[(0, 255, 255 - i) for i in range(256)],  # Green shift
         *[(i, 255, 0) for i in range(256)],  # Yellow shift
         *[(255, 255 - i, 0) for i in range(256)],  # Red shift
     ]
     hsv_start = color.to_hsv(color.to_rgb(starting_color or "#000000"))
     self.configure(**self.style.surface)
     self.col = _ColorSpace(self, hsv_start[0])
     self.col.pack()
     self.hue = hue = _ColorStrip(self, shifts)
     hue.pack()
     hue.on_change(self.adjust_strips)
     hue.on_implicit_change(self.recolor_strips)
     self.col.on_change(self.update_panel)
     self.monitor = monitor = panels.ColorInput(self)
     self.monitor.on_change(self.on_monitor_change)
     monitor.pack()
     self._on_change = None
Beispiel #3
0
 def set(self, hex_str: str) -> None:
     h, s, v = to_hsv(to_rgb(hex_str))
     self.h.set(round(h))
     self.s.set(round(s))
     self.v.set(round(v))
     self.initial = hex_str
Beispiel #4
0
 def set(self, hex_str: str) -> None:
     h, s, l = to_hsl(to_rgb(hex_str))
     self.h.set(round(h))
     self.s.set(round(s))
     self.l.set(round(l))
     self.initial = hex_str
Beispiel #5
0
 def set(self, hex_str: str) -> None:
     self.initial = hex_str
     r, g, b = to_rgb(hex_str)
     self.r.set(r)
     self.g.set(g)
     self.b.set(b)