code: def _palette_cmd(self, event):
          
          label = event.widget
          label.master.focus_set()
          label.master.configure(relief="sunken")
          r, g, b = self.winfo_rgb(label.cget("background"))
          r = round2(r * 255 / 65535)
          g = round2(g * 255 / 65535)
          b = round2(b * 255 / 65535)
          args = (r, g, b)
          if self.alpha_channel:
              a = self.alpha.get()
              args += (a,)
              self.alphabar.set_color(args)
          color = rgb_to_hexa(*args)
          h, s, v = rgb_to_hsv(r, g, b)
          self.red.set(r)
          self.green.set(g)
          self.blue.set(b)
          self.hue.set(h)
          self.saturation.set(s)
          self.value.set(v)
          self.hexa.delete(0, "end")
          self.hexa.insert(0, color.upper())
          self.bar.set(h)
          self.square.set_hsv((h, s, v))
          self._update_preview()
docs: Respond to user click on a palette item.