예제 #1
0
 def get_highlight_colors (self):
     bg = self.get_style_context().get_background_color(Gtk.StateFlags.SELECTED)
     default_color = (bg.red, bg.green, bg.blue)
     hsv = colors.rgb_to_hsv(*default_color)
     box_s = hsv[1]
     box_v = hsv[2]
     if box_v < 0.5:
         box_v = box_v * 2
     if box_s > 0.75:
         box_s = box_s * 0.5
     else:
         box_s = box_s * 1.5
         if box_s > 1:
             box_s = 1.0
     self.box_color = colors.hsv_to_rgb(hsv[0], box_s, box_v)
     self.box_and_row_color = colors.rotate_hue_rgb(*self.box_color, **{'rotate_by': 0.33 / 2})
     self.row_color = colors.rotate_hue_rgb(*self.box_color, **{'rotate_by': 0.33})
     self.col_color = colors.rotate_hue_rgb(*self.box_color, **{'rotate_by': 0.66})
     self.box_and_col_color = colors.rotate_hue_rgb(*self.box_color, **{'rotate_by': 1.0 - (0.33 / 2)})
예제 #2
0
 def get_highlight_colors(self):
     entry = self.__entries__.values()[0]
     default_color = gtkcolor_to_rgb(entry.style.bg[gtk.STATE_SELECTED])
     hsv = colors.rgb_to_hsv(*default_color)
     box_s = hsv[1]
     box_v = hsv[2]
     if box_v < 0.5:
         box_v = box_v * 2
     if box_s > 0.75:
         box_s = box_s * 0.5
     else:
         box_s = box_s * 1.5
         if box_s > 1:
             box_s = 1.0
     self.box_color = colors.hsv_to_rgb(hsv[0], box_s, box_v)
     self.box_and_row_color = colors.rotate_hue_rgb(*self.box_color, **{"rotate_by": 0.33 / 2})
     self.row_color = colors.rotate_hue_rgb(*self.box_color, **{"rotate_by": 0.33})
     self.col_color = colors.rotate_hue_rgb(*self.box_color, **{"rotate_by": 0.66})
     self.box_and_col_color = colors.rotate_hue_rgb(*self.box_color, **{"rotate_by": 1.0 - (0.33 / 2)})
예제 #3
0
파일: gsudoku.py 프로젝트: lucchouina/Rim
 def get_highlight_colors(self):
     entry = self.__entries__.values()[0]
     default_color = gtkcolor_to_rgb(entry.style.bg[gtk.STATE_SELECTED])
     hsv = colors.rgb_to_hsv(*default_color)
     box_s = hsv[1]
     box_v = hsv[2]
     if box_v < 0.5:
         box_v = box_v * 2
     if box_s > 0.75:
         box_s = box_s * 0.5
     else:
         box_s = box_s * 1.5
         if box_s > 1:
             box_s = 1.0
     self.box_color = colors.hsv_to_rgb(hsv[0], box_s, box_v)
     self.box_and_row_color = colors.rotate_hue_rgb(
         *self.box_color, **{'rotate_by': 0.33 / 2})
     self.row_color = colors.rotate_hue_rgb(*self.box_color,
                                            **{'rotate_by': 0.33})
     self.col_color = colors.rotate_hue_rgb(*self.box_color,
                                            **{'rotate_by': 0.66})
     self.box_and_col_color = colors.rotate_hue_rgb(
         *self.box_color, **{'rotate_by': 1.0 - (0.33 / 2)})