Beispiel #1
0
    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()
Beispiel #2
0
    def set_color_from_hex(self, hexa):
        """Set the foreground color from an hexadecimal string.
        @hexa: A string of six chars defining a color in hexadecimal format."""

        self.hex = hexa
        self.rgb = convert.hex_rgb(hexa)
        self.hsv = convert.rgb_hsv(self.rgb)
        self.update_external()
Beispiel #3
0
    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 = []