Пример #1
0
    def get_current_hex_color(self):
        """
            :return: The current HEX color
        """

        rgba = self.__current_colortoolitem.get_current_rgba()
        hex_color = rgb_to_hex(
            (rgba.red * 255, rgba.green * 255, rgba.blue * 255))

        return hex_color
Пример #2
0
    def _adapt_right_color(self, color):

        if isinstance(color, list):
            color = rgb_to_hex(color)

        color = color.replace("#", '')

        r = int(color[0:2], 16) // 16
        g = int(color[2:4], 16) // 16
        b = int(color[4:6], 16) // 16
        c = [0x00, 0x00]
        c[0] = r  # if r = 0xf > r*16 = 0xf0 > and b = 0xc r*16 + b 0xfc
        c[1] = g * 16 + b
        return c
Пример #3
0
    def get_hex_colors(self):

        hex_colors = []

        color_tool_items = [
            child for child in self.get_children()
            if isinstance(child, ColorToolItem)
        ]

        for color_tool_item in sorted(color_tool_items,
                                      key=lambda x: x.get_position()):
            rgba = color_tool_item.get_current_rgba()
            hex_color = rgb_to_hex(
                (rgba.red * 255, rgba.green * 255, rgba.blue * 255))
            hex_colors.append(hex_color)

        return hex_colors