def colorbox_update(self): """Updates colorbox color when is outdated.""" rgbcolor = main.color.rgb hexcolor = convert.rgb_hex(rgbcolor) gtkcolor = gtk.gdk.Color('#' + hexcolor) self.colorbox.modify_bg(gtk.STATE_NORMAL, gtkcolor)
def set_color_from_hsv(self, hsv): """Set the foreground color from hsv values. @hsv: Python 3-item list with values from 0 to 255.""" self.hsv = hsv self.rgb = convert.hsv_rgb(hsv) self.hex = convert.rgb_hex(self.rgb) self.update_external()
def set_color_from_rgb(self, rgb): """Set the foreground color from rgb values. @rgb: Python 3-item list with values from 0 to 255.""" self.rgb = rgb self.hsv = convert.rgb_hsv(rgb) self.hex = convert.rgb_hex(rgb) self.update_external()
def __init__(self): """Create the color management object at program start.""" main.log.info('loading color management') # Color values in several formats, rgb is the lead one. self.rgb = [0, 0, 0] self.rgb[0] = main.config.getint('color', 'r') self.rgb[1] = main.config.getint('color', 'g') self.rgb[2] = main.config.getint('color', 'b') self.hsv = convert.rgb_hsv(self.rgb) self.hex = convert.rgb_hex(self.rgb) # List of functions to call when color is updated. self.updated_todo = []