diff --git a/README.MD b/README.MD index 99b7987..5a6084a 100644 --- a/README.MD +++ b/README.MD @@ -116,7 +116,8 @@ When this error has occurred, please check the network environment. ## Update **If the dependency package error after updating, please double clicking ```repair_dependency.bat``` (for Official ComfyUI Protable) or ```repair_dependency_aki.bat``` (for ComfyUI-aki-v1.x) in the plugin folder to reinstall the dependency packages.
- +* Commit [GetMainColors](#GetMainColors) node, it can obtained 5 main colors of image. Commit [ColorName](#ColorName) node, it can obtain the color name of input color value. +* Duplicate the [Brightness & Contrast](#Brightness) node as [BrightnessContrastV2](#BrightnessContrastV2), and the [Color of Shadow & Highlight](#Highlight) node as [ColorofShadowHighlight](#HighlightV2) to avoid errors in ComfyUI workflow parsing caused by the "&" character in the node name. * Commit [VQAPrompt](#VQAPrompt) and [LoadVQAModel](#LoadVQAModel) nodes. Download the model from [BaiduNetdisk](https://pan.baidu.com/s/1ILREVgM0eFJlkWaYlKsR0g?pwd=yw75) or [huggingface.co/Salesforce/blip-vqa-capfilt-large](https://huggingface.co/Salesforce/blip-vqa-capfilt-large/tree/main) and [huggingface.co/Salesforce/blip-vqa-base](https://huggingface.co/Salesforce/blip-vqa-base/tree/main) and copy to ```ComfyUI\models\VQA``` folder. * [Florence2Ultra](#Florence2Ultra), [Florence2Image2Prompt](#Florence2Image2Prompt) 和 [LoadFlorence2Model](#LoadFlorence2Model) nodes support the MiaoshouAI/Florence-2-large-PromptGen-v1.5 and MiaoshouAI/Florence-2-base-PromptGen-v1.5 model. @@ -503,6 +504,8 @@ Node options: Node option: * exposure: Exposure value. Higher values indicate brighter image. +### Color of Shadow HighlightV2 +A replica of the ```Color of Shadow & Highlight``` node, with the "&" character removed from the node name to avoid ComfyUI workflow parsing errors. ### ColorTemperature ![image](image/color_temperature_example.jpg) @@ -554,6 +557,9 @@ Node options: * contrast: Value of contrast. * saturation: Value of saturation. +### BrightnessContrastV2 +A replica of the ```Brightness & Contrast``` node, with the "&" character removed from the node name to avoid ComfyUI workflow parsing errors. + ### RGB Adjust the RGB channels of the image. @@ -971,6 +977,32 @@ Output: * image: Solid color picture output, the size is the same as the input picture. * mask: Mask output. +### GetMainColors +Obtain the main color of the image. You can obtain 5 colors. +![image](image/get_main_color_and_color_name_example.jpg) +![image](image/get_main_colors_example.jpg) + +Node Options: +![image](image/get_main_color_node.jpg) +* image: The image input. +* k_means_algorithm:K-Means algorithm options. "lloyd" is the standard K-Means algorithm, while "elkan" is the triangle inequality algorithm, suitable for larger images. + +Outputs: +* preview_image: 5 main color preview images. +* color_1~color_5: Color value output. Output an RGB string in HEX format. + +### ColorName +Output the most similar color name in the color palette based on the color value. +![image](image/color_name_example.jpg) + +Node Options: +![image](image/color_name_node.jpg) +* color: Color value input, in HEX format RGB string format. +* palette: Color palette. ```xkcd``` includes 949 colors, ```css3``` includes 147 colors, and ```html4``` includes 16 colors. + +Output: +* color_name: Color name in string. + ### ExtendCanvas Extend the canvas ![image](image/extend_canvas_example.jpg) diff --git a/README_CN.MD b/README_CN.MD index 2d84aaf..26e5634 100644 --- a/README_CN.MD +++ b/README_CN.MD @@ -116,6 +116,8 @@ os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com' ## 更新说明 **如果本插件更新后出现依赖包错误,请双击运行插件目录下的```install_requirements.bat```(官方便携包),或 ```install_requirements_aki.bat```(秋叶整合包) 重新安装依赖包。 +* 添加 [GetMainColors](#GetMainColors) 节点,可获得图片的5个主要颜色。 添加 [ColorName](#ColorName) 节点,可获得颜色名称。 +* 复制 [Brightness & Contrast](#Brightness) 节点为 [BrightnessContrastV2](#BrightnessContrastV2), [Color of Shadow & Highlight](#Highlight) 节点为 [ColorofShadowHighlight](#HighlightV2), 避免节点名称中的"&"字符造成ComfyUI工作流解析错误。 * 添加 [VQAPrompt](#VQAPrompt) 和 [LoadVQAModel](#LoadVQAModel) 节点。 请从[百度网盘](https://pan.baidu.com/s/1ILREVgM0eFJlkWaYlKsR0g?pwd=yw75) 或者 [huggingface.co/Salesforce/blip-vqa-capfilt-large](https://huggingface.co/Salesforce/blip-vqa-capfilt-large/tree/main) 和 [huggingface.co/Salesforce/blip-vqa-base](https://huggingface.co/Salesforce/blip-vqa-base/tree/main) 下载全部模型文件并放到 ```ComfyUI\models\VQA```文件夹。 * [Florence2Ultra](#Florence2Ultra), [Florence2Image2Prompt](#Florence2Image2Prompt) 和 [LoadFlorence2Model](#LoadFlorence2Model) 节点支持MiaoshouAI/Florence-2-large-PromptGen-v1.5 和 MiaoshouAI/Florence-2-base-PromptGen-v1.5 模型。 @@ -497,6 +499,9 @@ os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com' * highlight_level_offset: 亮部取值的偏移量,更小的数值使更多靠近阴暗的区域纳入亮部。 * highlight_range: 亮部的过渡范围。 +### Color of Shadow HighlightV2 +Color of Shadow & Highlight 节点的复制品,去掉了节点名称中的"&"字符以避免ComfyUI工作流解析错误。 + ### ColorTemperature ![image](image/color_temperature_example.jpg) 改变图像的色温。 @@ -547,6 +552,8 @@ os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com' * contrast: 图像的对比度。 * saturation: 图像的色彩饱和度。 +### BrightnessContrastV2 +```Brightness & Contrast```节点的复制品,去掉了节点名称中的"&"字符以避免ComfyUI工作流解析错误。 ### RGB 对图像的RGB各通道进行调整。 @@ -956,6 +963,32 @@ GetColorTone的V2升级版。可以指定获取主体或背景的主色或平均 * image: 纯色图片输出, 尺寸与输入的图片相同。 * mask: 遮罩输出。 +### GetMainColors +获得图片的主色。可获得5个颜色。 +![image](image/get_main_color_and_color_name_example.jpg) +![image](image/get_main_colors_example.jpg) + +节点选项: +![image](image/get_main_color_node.jpg) +* image: 图片输入。 +* k_means_algorithm: K-Means 算法选项。 "lloyd" 为标准K-Means算法, "elkan" 为三角不等式算法,适合更大的图片。 + +输出: +* preview_image: 5个主色预览图片。 +* color_1~color_5: 色值输出。输出格式为HEX格式的RGB字符串。 + +### ColorName +根据色值输出调色盘里最近似的颜色名称。 +![image](image/color_name_example.jpg) + +节点选项: +![image](image/color_name_node.jpg) +* color: 颜色色值输入,格式为HEX格式的RGB字符串。 +* palette: 调色板。 ```xkcd```包括了949种颜色, ```css3```包括了147种颜色, ```html4```包括了16种颜色。 + +输出: +* color_name: 颜色名称,格式为字符串。 + ### ExtendCanvas 扩展画布。 ![image](image/extend_canvas_example.jpg) diff --git a/image/color_name_example.jpg b/image/color_name_example.jpg new file mode 100644 index 0000000..c5c6721 Binary files /dev/null and b/image/color_name_example.jpg differ diff --git a/image/color_name_node.jpg b/image/color_name_node.jpg new file mode 100644 index 0000000..cce4e76 Binary files /dev/null and b/image/color_name_node.jpg differ diff --git a/image/get_main_color_and_color_name_example.jpg b/image/get_main_color_and_color_name_example.jpg new file mode 100644 index 0000000..96c8019 Binary files /dev/null and b/image/get_main_color_and_color_name_example.jpg differ diff --git a/image/get_main_color_node.jpg b/image/get_main_color_node.jpg new file mode 100644 index 0000000..485ad3e Binary files /dev/null and b/image/get_main_color_node.jpg differ diff --git a/image/get_main_colors_example.jpg b/image/get_main_colors_example.jpg new file mode 100644 index 0000000..3379e75 Binary files /dev/null and b/image/get_main_colors_example.jpg differ diff --git a/py/color_correct_brightness_and_contrast.py b/py/color_correct_brightness_and_contrast.py index 7a1bbb9..853e541 100644 --- a/py/color_correct_brightness_and_contrast.py +++ b/py/color_correct_brightness_and_contrast.py @@ -1,11 +1,11 @@ from .imagefunc import * -NODE_NAME = 'Brightness & Contrast' + class ColorCorrectBrightnessAndContrast: def __init__(self): - pass + self.NODE_NAME = 'Brightness & Contrast' @classmethod def INPUT_TYPES(self): @@ -48,13 +48,64 @@ class ColorCorrectBrightnessAndContrast: ret_image = RGB2RGBA(ret_image, __image.split()[-1]) ret_images.append(pil2tensor(ret_image)) - log(f"{NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish') + log(f"{self.NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish') + return (torch.cat(ret_images, dim=0),) + + +# 节点名称去掉“&” +class LS_ColorCorrect_Brightness_And_Contrast_V2: + def __init__(self): + self.NODE_NAME = 'Brightness Contrast V2' + + @classmethod + def INPUT_TYPES(self): + + return { + "required": { + "image": ("IMAGE", ), # + "brightness": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}), + "contrast": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}), + "saturation": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}), + }, + "optional": { + } + } + + RETURN_TYPES = ("IMAGE",) + RETURN_NAMES = ("image",) + FUNCTION = 'color_correct_brightness_contrast_v2' + CATEGORY = '😺dzNodes/LayerColor' + + def color_correct_brightness_contrast_v2(self, image, brightness, contrast, saturation): + + ret_images = [] + + for i in image: + i = torch.unsqueeze(i,0) + __image = tensor2pil(i) + ret_image = __image.convert('RGB') + if brightness != 1: + brightness_image = ImageEnhance.Brightness(ret_image) + ret_image = brightness_image.enhance(factor=brightness) + if contrast != 1: + contrast_image = ImageEnhance.Contrast(ret_image) + ret_image = contrast_image.enhance(factor=contrast) + if saturation != 1: + color_image = ImageEnhance.Color(ret_image) + ret_image = color_image.enhance(factor=saturation) + + if __image.mode == 'RGBA': + ret_image = RGB2RGBA(ret_image, __image.split()[-1]) + ret_images.append(pil2tensor(ret_image)) + + log(f"{self.NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish') return (torch.cat(ret_images, dim=0),) NODE_CLASS_MAPPINGS = { - "LayerColor: Brightness & Contrast": ColorCorrectBrightnessAndContrast + "LayerColor: Brightness & Contrast": ColorCorrectBrightnessAndContrast, + "LayerColor: BrightnessContrastV2": LS_ColorCorrect_Brightness_And_Contrast_V2 } NODE_DISPLAY_NAME_MAPPINGS = { - "LayerColor: Brightness & Contrast": "LayerColor: Brightness & Contrast" + "LayerColor: BrightnessContrastV2": "LayerColor: Brightness Contrast V2" } \ No newline at end of file diff --git a/py/color_correct_shadow_and_highlight.py b/py/color_correct_shadow_and_highlight.py index 45ce6c6..a84997d 100644 --- a/py/color_correct_shadow_and_highlight.py +++ b/py/color_correct_shadow_and_highlight.py @@ -1,6 +1,6 @@ from .imagefunc import * -NODE_NAME = 'Color of Shadow & Highlight' + def norm_value(value): if value < 0.01: @@ -8,10 +8,11 @@ def norm_value(value): if value > 0.99: value = 0.99 return value + class ColorCorrectShadowAndHighlight: def __init__(self): - pass + self.NODE_NAME = 'Color of Shadow & Highlight' @classmethod def INPUT_TYPES(self): @@ -118,10 +119,125 @@ class ColorCorrectShadowAndHighlight: log(f"{NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish') return (torch.cat(ret_images, dim=0),) + +# 名称去掉“&” +class LS_ColorCorrectShadow_And_Highlight_V2: + + def __init__(self): + self.NODE_NAME = 'Color of Shadow & Highlight V2' + + @classmethod + def INPUT_TYPES(self): + + return { + "required": { + "image": ("IMAGE", ), + "shadow_brightness": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}), + "shadow_saturation": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}), + "shadow_hue": ("INT", {"default": 0, "min": -255, "max": 255, "step": 1}), + "shadow_level_offset": ("INT", {"default": 0, "min": -99, "max": 99, "step": 1}), + "shadow_range": ("FLOAT", {"default": 0.25, "min": 0.01, "max": 0.99, "step": 0.01}), + "highlight_brightness": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}), + "highlight_saturation": ("FLOAT", {"default": 1, "min": 0.0, "max": 3, "step": 0.01}), + "highlight_hue": ("INT", {"default": 0, "min": -255, "max": 255, "step": 1}), + "highlight_level_offset": ("INT", {"default": 0, "min": -99, "max": 99, "step": 1}), + "highlight_range": ("FLOAT", {"default": 0.25, "min": 0.01, "max": 0.99, "step": 0.01}), + }, + "optional": { + "mask": ("MASK",), # + } + } + + RETURN_TYPES = ("IMAGE",) + RETURN_NAMES = ("image",) + FUNCTION = 'color_shadow_and_highlight_v2' + CATEGORY = '😺dzNodes/LayerColor' + + def color_shadow_and_highlight_v2(self, image, + shadow_brightness, shadow_saturation, + shadow_level_offset, shadow_range, shadow_hue, + highlight_brightness, highlight_saturation, highlight_hue, + highlight_level_offset, highlight_range, + mask=None + ): + + ret_images = [] + input_images = [] + input_masks = [] + + for i in image: + input_images.append(torch.unsqueeze(i, 0)) + m = tensor2pil(i) + if m.mode == 'RGBA': + input_masks.append(m.split()[-1]) + else: + input_masks.append(Image.new('L', size=m.size, color='white')) + if mask is not None: + if mask.dim() == 2: + mask = torch.unsqueeze(mask, 0) + input_masks = [] + for m in mask: + input_masks.append(tensor2pil(torch.unsqueeze(m, 0)).convert('L')) + max_batch = max(len(input_images), len(input_masks)) + + for i in range(max_batch): + _image = input_images[i] if i < len(input_images) else input_images[-1] + _image = tensor2pil(_image).convert('RGB') + _mask = input_masks[i] if i < len(input_masks) else input_masks[-1] + + avg_gray = get_gray_average(_image, _mask) + shadow_level, highlight_level = calculate_shadow_highlight_level(avg_gray) + _canvas = _image.copy() + if shadow_saturation !=1 or shadow_brightness !=1 or shadow_hue: + shadow_low_threshold = (shadow_level + shadow_level_offset) / 100 + shadow_range / 2 + shadow_low_threshold = norm_value(shadow_low_threshold) + shadow_high_threshold = (shadow_level + shadow_level_offset) / 100 - shadow_range / 2 + shadow_high_threshold = norm_value(shadow_high_threshold) + _shadow_mask = luminance_keyer(_image, shadow_low_threshold, shadow_high_threshold) + _shadow = _image.copy() + if shadow_brightness != 1: + brightness_image = ImageEnhance.Brightness(_shadow) + _shadow = brightness_image.enhance(factor=shadow_brightness) + if shadow_saturation != 1: + color_image = ImageEnhance.Color(_shadow) + _shadow = color_image.enhance(factor=shadow_saturation) + if shadow_hue: + _h, _s, _v = _shadow.convert('HSV').split() + _h = image_hue_offset(_h, shadow_hue) + _shadow = image_channel_merge((_h, _s, _v), 'HSV') + _canvas.paste(_shadow, mask=gaussian_blur(_shadow_mask,(_shadow_mask.width + _shadow_mask.height)//800)) + _canvas.paste(_image, mask=ImageChops.invert(_mask)) + if highlight_saturation != 1 or highlight_brightness != 1 or highlight_hue: + highlight_low_threshold = (highlight_level + highlight_level_offset) / 100 - highlight_range / 2 + highlight_low_threshold = norm_value(highlight_low_threshold) + highlight_high_threshold = (highlight_level + highlight_level_offset) / 100 + highlight_range / 2 + highlight_high_threshold = norm_value(highlight_high_threshold) + _highlight_mask = luminance_keyer(_image, highlight_low_threshold, highlight_high_threshold) + _highlight = _image.copy() + if highlight_brightness != 1: + brightness_image = ImageEnhance.Brightness(_highlight) + _highlight = brightness_image.enhance(factor=highlight_brightness) + if highlight_saturation != 1: + color_image = ImageEnhance.Color(_highlight) + _highlight = color_image.enhance(factor=highlight_saturation) + if highlight_hue: + _h, _s, _v = _highlight.convert('HSV').split() + _h = image_hue_offset(_h, highlight_hue) + _highlight = image_channel_merge((_h, _s, _v), 'HSV') + _canvas.paste(_highlight, mask=gaussian_blur(_highlight_mask, (_highlight_mask.width + _highlight_mask.height)//800)) + _canvas.paste(_image, mask=ImageChops.invert(_mask)) + ret_images.append(pil2tensor(_canvas)) + + log(f"{NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish') + return (torch.cat(ret_images, dim=0),) + + NODE_CLASS_MAPPINGS = { - "LayerColor: Color of Shadow & Highlight": ColorCorrectShadowAndHighlight + "LayerColor: Color of Shadow & Highlight": ColorCorrectShadowAndHighlight, + "LayerColor: ColorofShadowHighlightV2": LS_ColorCorrectShadow_And_Highlight_V2 } NODE_DISPLAY_NAME_MAPPINGS = { - "LayerColor: Color of Shadow & Highlight": "LayerColor: Color of Shadow & Highlight" + "LayerColor: Color of Shadow & Highlight": "LayerColor: Color of Shadow & Highlight", + "LayerColor: ColorofShadowHighlightV2": "LayerColor: Colorof Shadow Highlight V2" } \ No newline at end of file diff --git a/py/color_name.py b/py/color_name.py new file mode 100644 index 0000000..f4c2416 --- /dev/null +++ b/py/color_name.py @@ -0,0 +1,1177 @@ +from .imagefunc import Hex_to_RGB + +class LS_ColorName: + + def __init__(self): + self.NODE_NAME = 'ColorName' + + # 预定义一组标准颜色名称和对应的 RGB 值 + self.CSS3_NAMES_TO_HEX = { + "aliceblue": "#f0f8ff", + "antiquewhite": "#faebd7", + "aqua": "#00ffff", + "aquamarine": "#7fffd4", + "azure": "#f0ffff", + "beige": "#f5f5dc", + "bisque": "#ffe4c4", + "black": "#000000", + "blanchedalmond": "#ffebcd", + "blue": "#0000ff", + "blueviolet": "#8a2be2", + "brown": "#a52a2a", + "burlywood": "#deb887", + "cadetblue": "#5f9ea0", + "chartreuse": "#7fff00", + "chocolate": "#d2691e", + "coral": "#ff7f50", + "cornflowerblue": "#6495ed", + "cornsilk": "#fff8dc", + "crimson": "#dc143c", + "cyan": "#00ffff", + "darkblue": "#00008b", + "darkcyan": "#008b8b", + "darkgoldenrod": "#b8860b", + "darkgray": "#a9a9a9", + "darkgrey": "#a9a9a9", + "darkgreen": "#006400", + "darkkhaki": "#bdb76b", + "darkmagenta": "#8b008b", + "darkolivegreen": "#556b2f", + "darkorange": "#ff8c00", + "darkorchid": "#9932cc", + "darkred": "#8b0000", + "darksalmon": "#e9967a", + "darkseagreen": "#8fbc8f", + "darkslateblue": "#483d8b", + "darkslategray": "#2f4f4f", + "darkslategrey": "#2f4f4f", + "darkturquoise": "#00ced1", + "darkviolet": "#9400d3", + "deeppink": "#ff1493", + "deepskyblue": "#00bfff", + "dimgray": "#696969", + "dimgrey": "#696969", + "dodgerblue": "#1e90ff", + "firebrick": "#b22222", + "floralwhite": "#fffaf0", + "forestgreen": "#228b22", + "fuchsia": "#ff00ff", + "gainsboro": "#dcdcdc", + "ghostwhite": "#f8f8ff", + "gold": "#ffd700", + "goldenrod": "#daa520", + "gray": "#808080", + "grey": "#808080", + "green": "#008000", + "greenyellow": "#adff2f", + "honeydew": "#f0fff0", + "hotpink": "#ff69b4", + "indianred": "#cd5c5c", + "indigo": "#4b0082", + "ivory": "#fffff0", + "khaki": "#f0e68c", + "lavender": "#e6e6fa", + "lavenderblush": "#fff0f5", + "lawngreen": "#7cfc00", + "lemonchiffon": "#fffacd", + "lightblue": "#add8e6", + "lightcoral": "#f08080", + "lightcyan": "#e0ffff", + "lightgoldenrodyellow": "#fafad2", + "lightgray": "#d3d3d3", + "lightgrey": "#d3d3d3", + "lightgreen": "#90ee90", + "lightpink": "#ffb6c1", + "lightsalmon": "#ffa07a", + "lightseagreen": "#20b2aa", + "lightskyblue": "#87cefa", + "lightslategray": "#778899", + "lightslategrey": "#778899", + "lightsteelblue": "#b0c4de", + "lightyellow": "#ffffe0", + "lime": "#00ff00", + "limegreen": "#32cd32", + "linen": "#faf0e6", + "magenta": "#ff00ff", + "maroon": "#800000", + "mediumaquamarine": "#66cdaa", + "mediumblue": "#0000cd", + "mediumorchid": "#ba55d3", + "mediumpurple": "#9370db", + "mediumseagreen": "#3cb371", + "mediumslateblue": "#7b68ee", + "mediumspringgreen": "#00fa9a", + "mediumturquoise": "#48d1cc", + "mediumvioletred": "#c71585", + "midnightblue": "#191970", + "mintcream": "#f5fffa", + "mistyrose": "#ffe4e1", + "moccasin": "#ffe4b5", + "navajowhite": "#ffdead", + "navy": "#000080", + "oldlace": "#fdf5e6", + "olive": "#808000", + "olivedrab": "#6b8e23", + "orange": "#ffa500", + "orangered": "#ff4500", + "orchid": "#da70d6", + "palegoldenrod": "#eee8aa", + "palegreen": "#98fb98", + "paleturquoise": "#afeeee", + "palevioletred": "#db7093", + "papayawhip": "#ffefd5", + "peachpuff": "#ffdab9", + "peru": "#cd853f", + "pink": "#ffc0cb", + "plum": "#dda0dd", + "powderblue": "#b0e0e6", + "purple": "#800080", + "red": "#ff0000", + "rosybrown": "#bc8f8f", + "royalblue": "#4169e1", + "saddlebrown": "#8b4513", + "salmon": "#fa8072", + "sandybrown": "#f4a460", + "seagreen": "#2e8b57", + "seashell": "#fff5ee", + "sienna": "#a0522d", + "silver": "#c0c0c0", + "skyblue": "#87ceeb", + "slateblue": "#6a5acd", + "slategray": "#708090", + "slategrey": "#708090", + "snow": "#fffafa", + "springgreen": "#00ff7f", + "steelblue": "#4682b4", + "tan": "#d2b48c", + "teal": "#008080", + "thistle": "#d8bfd8", + "tomato": "#ff6347", + "turquoise": "#40e0d0", + "violet": "#ee82ee", + "wheat": "#f5deb3", + "white": "#ffffff", + "whitesmoke": "#f5f5f5", + "yellow": "#ffff00", + "yellowgreen": "#9acd32", + } + + self.XKCD_NAME_TO_HEX = { + "cloudy blue": "#acc2d9", + "dark pastel green": "#56ae57", + "dust": "#b2996e", + "electric lime": "#a8ff04", + "fresh green": "#69d84f", + "light eggplant": "#894585", + "nasty green": "#70b23f", + "really light blue": "#d4ffff", + "tea": "#65ab7c", + "warm purple": "#952e8f", + "yellowish tan": "#fcfc81", + "cement": "#a5a391", + "dark grass green": "#388004", + "dusty teal": "#4c9085", + "grey teal": "#5e9b8a", + "macaroni and cheese": "#efb435", + "pinkish tan": "#d99b82", + "spruce": "#0a5f38", + "strong blue": "#0c06f7", + "toxic green": "#61de2a", + "windows blue": "#3778bf", + "blue blue": "#2242c7", + "blue with a hint of purple": "#533cc6", + "booger": "#9bb53c", + "bright sea green": "#05ffa6", + "dark green blue": "#1f6357", + "deep turquoise": "#017374", + "green teal": "#0cb577", + "strong pink": "#ff0789", + "bland": "#afa88b", + "deep aqua": "#08787f", + "lavender pink": "#dd85d7", + "light moss green": "#a6c875", + "light seafoam green": "#a7ffb5", + "olive yellow": "#c2b709", + "pig pink": "#e78ea5", + "deep lilac": "#966ebd", + "desert": "#ccad60", + "dusty lavender": "#ac86a8", + "purpley grey": "#947e94", + "purply": "#983fb2", + "candy pink": "#ff63e9", + "light pastel green": "#b2fba5", + "boring green": "#63b365", + "kiwi green": "#8ee53f", + "light grey green": "#b7e1a1", + "orange pink": "#ff6f52", + "tea green": "#bdf8a3", + "very light brown": "#d3b683", + "egg shell": "#fffcc4", + "eggplant purple": "#430541", + "powder pink": "#ffb2d0", + "reddish grey": "#997570", + "baby shit brown": "#ad900d", + "liliac": "#c48efd", + "stormy blue": "#507b9c", + "ugly brown": "#7d7103", + "custard": "#fffd78", + "darkish pink": "#da467d", + "deep brown": "#410200", + "greenish beige": "#c9d179", + "manilla": "#fffa86", + "off blue": "#5684ae", + "battleship grey": "#6b7c85", + "browny green": "#6f6c0a", + "bruise": "#7e4071", + "kelley green": "#009337", + "sickly yellow": "#d0e429", + "sunny yellow": "#fff917", + "azul": "#1d5dec", + "darkgreen": "#054907", + "green/yellow": "#b5ce08", + "lichen": "#8fb67b", + "light light green": "#c8ffb0", + "pale gold": "#fdde6c", + "sun yellow": "#ffdf22", + "tan green": "#a9be70", + "burple": "#6832e3", + "butterscotch": "#fdb147", + "toupe": "#c7ac7d", + "dark cream": "#fff39a", + "indian red": "#850e04", + "light lavendar": "#efc0fe", + "poison green": "#40fd14", + "baby puke green": "#b6c406", + "bright yellow green": "#9dff00", + "charcoal grey": "#3c4142", + "squash": "#f2ab15", + "cinnamon": "#ac4f06", + "light pea green": "#c4fe82", + "radioactive green": "#2cfa1f", + "raw sienna": "#9a6200", + "baby purple": "#ca9bf7", + "cocoa": "#875f42", + "light royal blue": "#3a2efe", + "orangeish": "#fd8d49", + "rust brown": "#8b3103", + "sand brown": "#cba560", + "swamp": "#698339", + "tealish green": "#0cdc73", + "burnt siena": "#b75203", + "camo": "#7f8f4e", + "dusk blue": "#26538d", + "fern": "#63a950", + "old rose": "#c87f89", + "pale light green": "#b1fc99", + "peachy pink": "#ff9a8a", + "rosy pink": "#f6688e", + "light bluish green": "#76fda8", + "light bright green": "#53fe5c", + "light neon green": "#4efd54", + "light seafoam": "#a0febf", + "tiffany blue": "#7bf2da", + "washed out green": "#bcf5a6", + "browny orange": "#ca6b02", + "nice blue": "#107ab0", + "sapphire": "#2138ab", + "greyish teal": "#719f91", + "orangey yellow": "#fdb915", + "parchment": "#fefcaf", + "straw": "#fcf679", + "very dark brown": "#1d0200", + "terracota": "#cb6843", + "ugly blue": "#31668a", + "clear blue": "#247afd", + "creme": "#ffffb6", + "foam green": "#90fda9", + "grey/green": "#86a17d", + "light gold": "#fddc5c", + "seafoam blue": "#78d1b6", + "topaz": "#13bbaf", + "violet pink": "#fb5ffc", + "wintergreen": "#20f986", + "yellow tan": "#ffe36e", + "dark fuchsia": "#9d0759", + "indigo blue": "#3a18b1", + "light yellowish green": "#c2ff89", + "pale magenta": "#d767ad", + "rich purple": "#720058", + "sunflower yellow": "#ffda03", + "green/blue": "#01c08d", + "leather": "#ac7434", + "racing green": "#014600", + "vivid purple": "#9900fa", + "dark royal blue": "#02066f", + "hazel": "#8e7618", + "muted pink": "#d1768f", + "booger green": "#96b403", + "canary": "#fdff63", + "cool grey": "#95a3a6", + "dark taupe": "#7f684e", + "darkish purple": "#751973", + "true green": "#089404", + "coral pink": "#ff6163", + "dark sage": "#598556", + "dark slate blue": "#214761", + "flat blue": "#3c73a8", + "mushroom": "#ba9e88", + "rich blue": "#021bf9", + "dirty purple": "#734a65", + "greenblue": "#23c48b", + "icky green": "#8fae22", + "light khaki": "#e6f2a2", + "warm blue": "#4b57db", + "dark hot pink": "#d90166", + "deep sea blue": "#015482", + "carmine": "#9d0216", + "dark yellow green": "#728f02", + "pale peach": "#ffe5ad", + "plum purple": "#4e0550", + "golden rod": "#f9bc08", + "neon red": "#ff073a", + "old pink": "#c77986", + "very pale blue": "#d6fffe", + "blood orange": "#fe4b03", + "grapefruit": "#fd5956", + "sand yellow": "#fce166", + "clay brown": "#b2713d", + "dark blue grey": "#1f3b4d", + "flat green": "#699d4c", + "light green blue": "#56fca2", + "warm pink": "#fb5581", + "dodger blue": "#3e82fc", + "gross green": "#a0bf16", + "ice": "#d6fffa", + "metallic blue": "#4f738e", + "pale salmon": "#ffb19a", + "sap green": "#5c8b15", + "algae": "#54ac68", + "bluey grey": "#89a0b0", + "greeny grey": "#7ea07a", + "highlighter green": "#1bfc06", + "light light blue": "#cafffb", + "light mint": "#b6ffbb", + "raw umber": "#a75e09", + "vivid blue": "#152eff", + "deep lavender": "#8d5eb7", + "dull teal": "#5f9e8f", + "light greenish blue": "#63f7b4", + "mud green": "#606602", + "pinky": "#fc86aa", + "red wine": "#8c0034", + "shit green": "#758000", + "tan brown": "#ab7e4c", + "darkblue": "#030764", + "rosa": "#fe86a4", + "lipstick": "#d5174e", + "pale mauve": "#fed0fc", + "claret": "#680018", + "dandelion": "#fedf08", + "orangered": "#fe420f", + "poop green": "#6f7c00", + "ruby": "#ca0147", + "dark": "#1b2431", + "greenish turquoise": "#00fbb0", + "pastel red": "#db5856", + "piss yellow": "#ddd618", + "bright cyan": "#41fdfe", + "dark coral": "#cf524e", + "algae green": "#21c36f", + "darkish red": "#a90308", + "reddy brown": "#6e1005", + "blush pink": "#fe828c", + "camouflage green": "#4b6113", + "lawn green": "#4da409", + "putty": "#beae8a", + "vibrant blue": "#0339f8", + "dark sand": "#a88f59", + "purple/blue": "#5d21d0", + "saffron": "#feb209", + "twilight": "#4e518b", + "warm brown": "#964e02", + "bluegrey": "#85a3b2", + "bubble gum pink": "#ff69af", + "duck egg blue": "#c3fbf4", + "greenish cyan": "#2afeb7", + "petrol": "#005f6a", + "royal": "#0c1793", + "butter": "#ffff81", + "dusty orange": "#f0833a", + "off yellow": "#f1f33f", + "pale olive green": "#b1d27b", + "orangish": "#fc824a", + "leaf": "#71aa34", + "light blue grey": "#b7c9e2", + "dried blood": "#4b0101", + "lightish purple": "#a552e6", + "rusty red": "#af2f0d", + "lavender blue": "#8b88f8", + "light grass green": "#9af764", + "light mint green": "#a6fbb2", + "sunflower": "#ffc512", + "velvet": "#750851", + "brick orange": "#c14a09", + "lightish red": "#fe2f4a", + "pure blue": "#0203e2", + "twilight blue": "#0a437a", + "violet red": "#a50055", + "yellowy brown": "#ae8b0c", + "carnation": "#fd798f", + "muddy yellow": "#bfac05", + "dark seafoam green": "#3eaf76", + "deep rose": "#c74767", + "dusty red": "#b9484e", + "grey/blue": "#647d8e", + "lemon lime": "#bffe28", + "purple/pink": "#d725de", + "brown yellow": "#b29705", + "purple brown": "#673a3f", + "wisteria": "#a87dc2", + "banana yellow": "#fafe4b", + "lipstick red": "#c0022f", + "water blue": "#0e87cc", + "brown grey": "#8d8468", + "vibrant purple": "#ad03de", + "baby green": "#8cff9e", + "barf green": "#94ac02", + "eggshell blue": "#c4fff7", + "sandy yellow": "#fdee73", + "cool green": "#33b864", + "pale": "#fff9d0", + "blue/grey": "#758da3", + "hot magenta": "#f504c9", + "greyblue": "#77a1b5", + "purpley": "#8756e4", + "baby shit green": "#889717", + "brownish pink": "#c27e79", + "dark aquamarine": "#017371", + "diarrhea": "#9f8303", + "light mustard": "#f7d560", + "pale sky blue": "#bdf6fe", + "turtle green": "#75b84f", + "bright olive": "#9cbb04", + "dark grey blue": "#29465b", + "greeny brown": "#696006", + "lemon green": "#adf802", + "light periwinkle": "#c1c6fc", + "seaweed green": "#35ad6b", + "sunshine yellow": "#fffd37", + "ugly purple": "#a442a0", + "medium pink": "#f36196", + "puke brown": "#947706", + "very light pink": "#fff4f2", + "viridian": "#1e9167", + "bile": "#b5c306", + "faded yellow": "#feff7f", + "very pale green": "#cffdbc", + "vibrant green": "#0add08", + "bright lime": "#87fd05", + "spearmint": "#1ef876", + "light aquamarine": "#7bfdc7", + "light sage": "#bcecac", + "yellowgreen": "#bbf90f", + "baby poo": "#ab9004", + "dark seafoam": "#1fb57a", + "deep teal": "#00555a", + "heather": "#a484ac", + "rust orange": "#c45508", + "dirty blue": "#3f829d", + "fern green": "#548d44", + "bright lilac": "#c95efb", + "weird green": "#3ae57f", + "peacock blue": "#016795", + "avocado green": "#87a922", + "faded orange": "#f0944d", + "grape purple": "#5d1451", + "hot green": "#25ff29", + "lime yellow": "#d0fe1d", + "mango": "#ffa62b", + "shamrock": "#01b44c", + "bubblegum": "#ff6cb5", + "purplish brown": "#6b4247", + "vomit yellow": "#c7c10c", + "pale cyan": "#b7fffa", + "key lime": "#aeff6e", + "tomato red": "#ec2d01", + "lightgreen": "#76ff7b", + "merlot": "#730039", + "night blue": "#040348", + "purpleish pink": "#df4ec8", + "apple": "#6ecb3c", + "baby poop green": "#8f9805", + "green apple": "#5edc1f", + "heliotrope": "#d94ff5", + "yellow/green": "#c8fd3d", + "almost black": "#070d0d", + "cool blue": "#4984b8", + "leafy green": "#51b73b", + "mustard brown": "#ac7e04", + "dusk": "#4e5481", + "dull brown": "#876e4b", + "frog green": "#58bc08", + "vivid green": "#2fef10", + "bright light green": "#2dfe54", + "fluro green": "#0aff02", + "kiwi": "#9cef43", + "seaweed": "#18d17b", + "navy green": "#35530a", + "ultramarine blue": "#1805db", + "iris": "#6258c4", + "pastel orange": "#ff964f", + "yellowish orange": "#ffab0f", + "perrywinkle": "#8f8ce7", + "tealish": "#24bca8", + "dark plum": "#3f012c", + "pear": "#cbf85f", + "pinkish orange": "#ff724c", + "midnight purple": "#280137", + "light urple": "#b36ff6", + "dark mint": "#48c072", + "greenish tan": "#bccb7a", + "light burgundy": "#a8415b", + "turquoise blue": "#06b1c4", + "ugly pink": "#cd7584", + "sandy": "#f1da7a", + "electric pink": "#ff0490", + "muted purple": "#805b87", + "mid green": "#50a747", + "greyish": "#a8a495", + "neon yellow": "#cfff04", + "banana": "#ffff7e", + "carnation pink": "#ff7fa7", + "tomato": "#ef4026", + "sea": "#3c9992", + "muddy brown": "#886806", + "turquoise green": "#04f489", + "buff": "#fef69e", + "fawn": "#cfaf7b", + "muted blue": "#3b719f", + "pale rose": "#fdc1c5", + "dark mint green": "#20c073", + "amethyst": "#9b5fc0", + "blue/green": "#0f9b8e", + "chestnut": "#742802", + "sick green": "#9db92c", + "pea": "#a4bf20", + "rusty orange": "#cd5909", + "stone": "#ada587", + "rose red": "#be013c", + "pale aqua": "#b8ffeb", + "deep orange": "#dc4d01", + "earth": "#a2653e", + "mossy green": "#638b27", + "grassy green": "#419c03", + "pale lime green": "#b1ff65", + "light grey blue": "#9dbcd4", + "pale grey": "#fdfdfe", + "asparagus": "#77ab56", + "blueberry": "#464196", + "purple red": "#990147", + "pale lime": "#befd73", + "greenish teal": "#32bf84", + "caramel": "#af6f09", + "deep magenta": "#a0025c", + "light peach": "#ffd8b1", + "milk chocolate": "#7f4e1e", + "ocher": "#bf9b0c", + "off green": "#6ba353", + "purply pink": "#f075e6", + "lightblue": "#7bc8f6", + "dusky blue": "#475f94", + "golden": "#f5bf03", + "light beige": "#fffeb6", + "butter yellow": "#fffd74", + "dusky purple": "#895b7b", + "french blue": "#436bad", + "ugly yellow": "#d0c101", + "greeny yellow": "#c6f808", + "orangish red": "#f43605", + "shamrock green": "#02c14d", + "orangish brown": "#b25f03", + "tree green": "#2a7e19", + "deep violet": "#490648", + "gunmetal": "#536267", + "blue/purple": "#5a06ef", + "cherry": "#cf0234", + "sandy brown": "#c4a661", + "warm grey": "#978a84", + "dark indigo": "#1f0954", + "midnight": "#03012d", + "bluey green": "#2bb179", + "grey pink": "#c3909b", + "soft purple": "#a66fb5", + "blood": "#770001", + "brown red": "#922b05", + "medium grey": "#7d7f7c", + "berry": "#990f4b", + "poo": "#8f7303", + "purpley pink": "#c83cb9", + "light salmon": "#fea993", + "snot": "#acbb0d", + "easter purple": "#c071fe", + "light yellow green": "#ccfd7f", + "dark navy blue": "#00022e", + "drab": "#828344", + "light rose": "#ffc5cb", + "rouge": "#ab1239", + "purplish red": "#b0054b", + "slime green": "#99cc04", + "baby poop": "#937c00", + "irish green": "#019529", + "pink/purple": "#ef1de7", + "dark navy": "#000435", + "greeny blue": "#42b395", + "light plum": "#9d5783", + "pinkish grey": "#c8aca9", + "dirty orange": "#c87606", + "rust red": "#aa2704", + "pale lilac": "#e4cbff", + "orangey red": "#fa4224", + "primary blue": "#0804f9", + "kermit green": "#5cb200", + "brownish purple": "#76424e", + "murky green": "#6c7a0e", + "wheat": "#fbdd7e", + "very dark purple": "#2a0134", + "bottle green": "#044a05", + "watermelon": "#fd4659", + "deep sky blue": "#0d75f8", + "fire engine red": "#fe0002", + "yellow ochre": "#cb9d06", + "pumpkin orange": "#fb7d07", + "pale olive": "#b9cc81", + "light lilac": "#edc8ff", + "lightish green": "#61e160", + "carolina blue": "#8ab8fe", + "mulberry": "#920a4e", + "shocking pink": "#fe02a2", + "auburn": "#9a3001", + "bright lime green": "#65fe08", + "celadon": "#befdb7", + "pinkish brown": "#b17261", + "poo brown": "#885f01", + "bright sky blue": "#02ccfe", + "celery": "#c1fd95", + "dirt brown": "#836539", + "strawberry": "#fb2943", + "dark lime": "#84b701", + "copper": "#b66325", + "medium brown": "#7f5112", + "muted green": "#5fa052", + "robin's egg": "#6dedfd", + "bright aqua": "#0bf9ea", + "bright lavender": "#c760ff", + "ivory": "#ffffcb", + "very light purple": "#f6cefc", + "light navy": "#155084", + "pink red": "#f5054f", + "olive brown": "#645403", + "poop brown": "#7a5901", + "mustard green": "#a8b504", + "ocean green": "#3d9973", + "very dark blue": "#000133", + "dusty green": "#76a973", + "light navy blue": "#2e5a88", + "minty green": "#0bf77d", + "adobe": "#bd6c48", + "barney": "#ac1db8", + "jade green": "#2baf6a", + "bright light blue": "#26f7fd", + "light lime": "#aefd6c", + "dark khaki": "#9b8f55", + "orange yellow": "#ffad01", + "ocre": "#c69c04", + "maize": "#f4d054", + "faded pink": "#de9dac", + "british racing green": "#05480d", + "sandstone": "#c9ae74", + "mud brown": "#60460f", + "light sea green": "#98f6b0", + "robin egg blue": "#8af1fe", + "aqua marine": "#2ee8bb", + "dark sea green": "#11875d", + "soft pink": "#fdb0c0", + "orangey brown": "#b16002", + "cherry red": "#f7022a", + "burnt yellow": "#d5ab09", + "brownish grey": "#86775f", + "camel": "#c69f59", + "purplish grey": "#7a687f", + "marine": "#042e60", + "greyish pink": "#c88d94", + "pale turquoise": "#a5fbd5", + "pastel yellow": "#fffe71", + "bluey purple": "#6241c7", + "canary yellow": "#fffe40", + "faded red": "#d3494e", + "sepia": "#985e2b", + "coffee": "#a6814c", + "bright magenta": "#ff08e8", + "mocha": "#9d7651", + "ecru": "#feffca", + "purpleish": "#98568d", + "cranberry": "#9e003a", + "darkish green": "#287c37", + "brown orange": "#b96902", + "dusky rose": "#ba6873", + "melon": "#ff7855", + "sickly green": "#94b21c", + "silver": "#c5c9c7", + "purply blue": "#661aee", + "purpleish blue": "#6140ef", + "hospital green": "#9be5aa", + "shit brown": "#7b5804", + "mid blue": "#276ab3", + "amber": "#feb308", + "easter green": "#8cfd7e", + "soft blue": "#6488ea", + "cerulean blue": "#056eee", + "golden brown": "#b27a01", + "bright turquoise": "#0ffef9", + "red pink": "#fa2a55", + "red purple": "#820747", + "greyish brown": "#7a6a4f", + "vermillion": "#f4320c", + "russet": "#a13905", + "steel grey": "#6f828a", + "lighter purple": "#a55af4", + "bright violet": "#ad0afd", + "prussian blue": "#004577", + "slate green": "#658d6d", + "dirty pink": "#ca7b80", + "dark blue green": "#005249", + "pine": "#2b5d34", + "yellowy green": "#bff128", + "dark gold": "#b59410", + "bluish": "#2976bb", + "darkish blue": "#014182", + "dull red": "#bb3f3f", + "pinky red": "#fc2647", + "bronze": "#a87900", + "pale teal": "#82cbb2", + "military green": "#667c3e", + "barbie pink": "#fe46a5", + "bubblegum pink": "#fe83cc", + "pea soup green": "#94a617", + "dark mustard": "#a88905", + "shit": "#7f5f00", + "medium purple": "#9e43a2", + "very dark green": "#062e03", + "dirt": "#8a6e45", + "dusky pink": "#cc7a8b", + "red violet": "#9e0168", + "lemon yellow": "#fdff38", + "pistachio": "#c0fa8b", + "dull yellow": "#eedc5b", + "dark lime green": "#7ebd01", + "denim blue": "#3b5b92", + "teal blue": "#01889f", + "lightish blue": "#3d7afd", + "purpley blue": "#5f34e7", + "light indigo": "#6d5acf", + "swamp green": "#748500", + "brown green": "#706c11", + "dark maroon": "#3c0008", + "hot purple": "#cb00f5", + "dark forest green": "#002d04", + "faded blue": "#658cbb", + "drab green": "#749551", + "light lime green": "#b9ff66", + "snot green": "#9dc100", + "yellowish": "#faee66", + "light blue green": "#7efbb3", + "bordeaux": "#7b002c", + "light mauve": "#c292a1", + "ocean": "#017b92", + "marigold": "#fcc006", + "muddy green": "#657432", + "dull orange": "#d8863b", + "steel": "#738595", + "electric purple": "#aa23ff", + "fluorescent green": "#08ff08", + "yellowish brown": "#9b7a01", + "blush": "#f29e8e", + "soft green": "#6fc276", + "bright orange": "#ff5b00", + "lemon": "#fdff52", + "purple grey": "#866f85", + "acid green": "#8ffe09", + "pale lavender": "#eecffe", + "violet blue": "#510ac9", + "light forest green": "#4f9153", + "burnt red": "#9f2305", + "khaki green": "#728639", + "cerise": "#de0c62", + "faded purple": "#916e99", + "apricot": "#ffb16d", + "dark olive green": "#3c4d03", + "grey brown": "#7f7053", + "green grey": "#77926f", + "true blue": "#010fcc", + "pale violet": "#ceaefa", + "periwinkle blue": "#8f99fb", + "light sky blue": "#c6fcff", + "blurple": "#5539cc", + "green brown": "#544e03", + "bluegreen": "#017a79", + "bright teal": "#01f9c6", + "brownish yellow": "#c9b003", + "pea soup": "#929901", + "forest": "#0b5509", + "barney purple": "#a00498", + "ultramarine": "#2000b1", + "purplish": "#94568c", + "puke yellow": "#c2be0e", + "bluish grey": "#748b97", + "dark periwinkle": "#665fd1", + "dark lilac": "#9c6da5", + "reddish": "#c44240", + "light maroon": "#a24857", + "dusty purple": "#825f87", + "terra cotta": "#c9643b", + "avocado": "#90b134", + "marine blue": "#01386a", + "teal green": "#25a36f", + "slate grey": "#59656d", + "lighter green": "#75fd63", + "electric green": "#21fc0d", + "dusty blue": "#5a86ad", + "golden yellow": "#fec615", + "bright yellow": "#fffd01", + "light lavender": "#dfc5fe", + "umber": "#b26400", + "poop": "#7f5e00", + "dark peach": "#de7e5d", + "jungle green": "#048243", + "eggshell": "#ffffd4", + "denim": "#3b638c", + "yellow brown": "#b79400", + "dull purple": "#84597e", + "chocolate brown": "#411900", + "wine red": "#7b0323", + "neon blue": "#04d9ff", + "dirty green": "#667e2c", + "light tan": "#fbeeac", + "ice blue": "#d7fffe", + "cadet blue": "#4e7496", + "dark mauve": "#874c62", + "very light blue": "#d5ffff", + "grey purple": "#826d8c", + "pastel pink": "#ffbacd", + "very light green": "#d1ffbd", + "dark sky blue": "#448ee4", + "evergreen": "#05472a", + "dull pink": "#d5869d", + "aubergine": "#3d0734", + "mahogany": "#4a0100", + "reddish orange": "#f8481c", + "deep green": "#02590f", + "vomit green": "#89a203", + "purple pink": "#e03fd8", + "dusty pink": "#d58a94", + "faded green": "#7bb274", + "camo green": "#526525", + "pinky purple": "#c94cbe", + "pink purple": "#db4bda", + "brownish red": "#9e3623", + "dark rose": "#b5485d", + "mud": "#735c12", + "brownish": "#9c6d57", + "emerald green": "#028f1e", + "pale brown": "#b1916e", + "dull blue": "#49759c", + "burnt umber": "#a0450e", + "medium green": "#39ad48", + "clay": "#b66a50", + "light aqua": "#8cffdb", + "light olive green": "#a4be5c", + "brownish orange": "#cb7723", + "dark aqua": "#05696b", + "purplish pink": "#ce5dae", + "dark salmon": "#c85a53", + "greenish grey": "#96ae8d", + "jade": "#1fa774", + "ugly green": "#7a9703", + "dark beige": "#ac9362", + "emerald": "#01a049", + "pale red": "#d9544d", + "light magenta": "#fa5ff7", + "sky": "#82cafc", + "light cyan": "#acfffc", + "yellow orange": "#fcb001", + "reddish purple": "#910951", + "reddish pink": "#fe2c54", + "orchid": "#c875c4", + "dirty yellow": "#cdc50a", + "orange red": "#fd411e", + "deep red": "#9a0200", + "orange brown": "#be6400", + "cobalt blue": "#030aa7", + "neon pink": "#fe019a", + "rose pink": "#f7879a", + "greyish purple": "#887191", + "raspberry": "#b00149", + "aqua green": "#12e193", + "salmon pink": "#fe7b7c", + "tangerine": "#ff9408", + "brownish green": "#6a6e09", + "red brown": "#8b2e16", + "greenish brown": "#696112", + "pumpkin": "#e17701", + "pine green": "#0a481e", + "charcoal": "#343837", + "baby pink": "#ffb7ce", + "cornflower": "#6a79f7", + "blue violet": "#5d06e9", + "chocolate": "#3d1c02", + "greyish green": "#82a67d", + "scarlet": "#be0119", + "green yellow": "#c9ff27", + "dark olive": "#373e02", + "sienna": "#a9561e", + "pastel purple": "#caa0ff", + "terracotta": "#ca6641", + "aqua blue": "#02d8e9", + "sage green": "#88b378", + "blood red": "#980002", + "deep pink": "#cb0162", + "grass": "#5cac2d", + "moss": "#769958", + "pastel blue": "#a2bffe", + "bluish green": "#10a674", + "green blue": "#06b48b", + "dark tan": "#af884a", + "greenish blue": "#0b8b87", + "pale orange": "#ffa756", + "vomit": "#a2a415", + "forrest green": "#154406", + "dark lavender": "#856798", + "dark violet": "#34013f", + "purple blue": "#632de9", + "dark cyan": "#0a888a", + "olive drab": "#6f7632", + "pinkish": "#d46a7e", + "cobalt": "#1e488f", + "neon purple": "#bc13fe", + "light turquoise": "#7ef4cc", + "apple green": "#76cd26", + "dull green": "#74a662", + "wine": "#80013f", + "powder blue": "#b1d1fc", + "off white": "#ffffe4", + "electric blue": "#0652ff", + "dark turquoise": "#045c5a", + "blue purple": "#5729ce", + "azure": "#069af3", + "bright red": "#ff000d", + "pinkish red": "#f10c45", + "cornflower blue": "#5170d7", + "light olive": "#acbf69", + "grape": "#6c3461", + "greyish blue": "#5e819d", + "purplish blue": "#601ef9", + "yellowish green": "#b0dd16", + "greenish yellow": "#cdfd02", + "medium blue": "#2c6fbb", + "dusty rose": "#c0737a", + "light violet": "#d6b4fc", + "midnight blue": "#020035", + "bluish purple": "#703be7", + "red orange": "#fd3c06", + "dark magenta": "#960056", + "greenish": "#40a368", + "ocean blue": "#03719c", + "coral": "#fc5a50", + "cream": "#ffffc2", + "reddish brown": "#7f2b0a", + "burnt sienna": "#b04e0f", + "brick": "#a03623", + "sage": "#87ae73", + "grey green": "#789b73", + "white": "#ffffff", + "robin's egg blue": "#98eff9", + "moss green": "#658b38", + "steel blue": "#5a7d9a", + "eggplant": "#380835", + "light yellow": "#fffe7a", + "leaf green": "#5ca904", + "light grey": "#d8dcd6", + "puke": "#a5a502", + "pinkish purple": "#d648d7", + "sea blue": "#047495", + "pale purple": "#b790d4", + "slate blue": "#5b7c99", + "blue grey": "#607c8e", + "hunter green": "#0b4008", + "fuchsia": "#ed0dd9", + "crimson": "#8c000f", + "pale yellow": "#ffff84", + "ochre": "#bf9005", + "mustard yellow": "#d2bd0a", + "light red": "#ff474c", + "cerulean": "#0485d1", + "pale pink": "#ffcfdc", + "deep blue": "#040273", + "rust": "#a83c09", + "light teal": "#90e4c1", + "slate": "#516572", + "goldenrod": "#fac205", + "dark yellow": "#d5b60a", + "dark grey": "#363737", + "army green": "#4b5d16", + "grey blue": "#6b8ba4", + "seafoam": "#80f9ad", + "puce": "#a57e52", + "spring green": "#a9f971", + "dark orange": "#c65102", + "sand": "#e2ca76", + "pastel green": "#b0ff9d", + "mint": "#9ffeb0", + "light orange": "#fdaa48", + "bright pink": "#fe01b1", + "chartreuse": "#c1f80a", + "deep purple": "#36013f", + "dark brown": "#341c02", + "taupe": "#b9a281", + "pea green": "#8eab12", + "puke green": "#9aae07", + "kelly green": "#02ab2e", + "seafoam green": "#7af9ab", + "blue green": "#137e6d", + "khaki": "#aaa662", + "burgundy": "#610023", + "dark teal": "#014d4e", + "brick red": "#8f1402", + "royal purple": "#4b006e", + "plum": "#580f41", + "mint green": "#8fff9f", + "gold": "#dbb40c", + "baby blue": "#a2cffe", + "yellow green": "#c0fb2d", + "bright purple": "#be03fd", + "dark red": "#840000", + "pale blue": "#d0fefe", + "grass green": "#3f9b0b", + "navy": "#01153e", + "aquamarine": "#04d8b2", + "burnt orange": "#c04e01", + "neon green": "#0cff0c", + "bright blue": "#0165fc", + "rose": "#cf6275", + "light pink": "#ffd1df", + "mustard": "#ceb301", + "indigo": "#380282", + "lime": "#aaff32", + "sea green": "#53fca1", + "periwinkle": "#8e82fe", + "dark pink": "#cb416b", + "olive green": "#677a04", + "peach": "#ffb07c", + "pale green": "#c7fdb5", + "light brown": "#ad8150", + "hot pink": "#ff028d", + "black": "#000000", + "lilac": "#cea2fd", + "navy blue": "#001146", + "royal blue": "#0504aa", + "beige": "#e6daa6", + "salmon": "#ff796c", + "olive": "#6e750e", + "maroon": "#650021", + "bright green": "#01ff07", + "dark purple": "#35063e", + "mauve": "#ae7181", + "forest green": "#06470c", + "aqua": "#13eac9", + "cyan": "#00ffff", + "tan": "#d1b26f", + "dark blue": "#00035b", + "lavender": "#c79fef", + "turquoise": "#06c2ac", + "dark green": "#033500", + "violet": "#9a0eea", + "light purple": "#bf77f6", + "lime green": "#89fe05", + "grey": "#929591", + "sky blue": "#75bbfd", + "yellow": "#ffff14", + "magenta": "#c20078", + "light green": "#96f97b", + "orange": "#f97306", + "teal": "#029386", + "light blue": "#95d0fc", + "red": "#e50000", + "brown": "#653700", + "pink": "#ff81c0", + "blue": "#0343df", + "green": "#15b01a", + "purple": "#7e1e9c" + } + self.HTML4_NAMES_TO_HEX = { + "aqua": "#00ffff", + "black": "#000000", + "blue": "#0000ff", + "fuchsia": "#ff00ff", + "green": "#008000", + "gray": "#808080", + "lime": "#00ff00", + "maroon": "#800000", + "navy": "#000080", + "olive": "#808000", + "purple": "#800080", + "red": "#ff0000", + "silver": "#c0c0c0", + "teal": "#008080", + "white": "#ffffff", + "yellow": "#ffff00", + } + + + @classmethod + def INPUT_TYPES(self): + palette_list = ['xkcd', 'css3', 'html4'] + return { + "required": { + "color": ("STRING", {"default": "#000000", "forceInput":True},), + "palette": (palette_list,), + }, + "optional": { + } + } + + RETURN_TYPES = ("STRING",) + RETURN_NAMES = ("color_name",) + FUNCTION = 'get_color_name' + CATEGORY = '😺dzNodes/LayerColor' + + def get_color_name(self, color, palette): + (r, g, b) = Hex_to_RGB(color) + # r_percent = r / 255 * 100 + # g_percent = g / 255 * 100 + # b_percent = b / 255 * 100 + + if palette == "xkcd": + color_table = self.XKCD_NAME_TO_HEX + elif palette == "css3": + color_table = self.CSS3_NAMES_TO_HEX + else: + color_table = self.HTML4_NAMES_TO_HEX + min_colors = {} + for name, hex_code in color_table.items(): + r_c, g_c, b_c = Hex_to_RGB(hex_code) + rd = (r_c - r) ** 2 + gd = (g_c - g) ** 2 + bd = (b_c - b) ** 2 + min_colors[(rd + gd + bd)] = name + color_name = min_colors[min(min_colors.keys())] + + return (color_name,) + + +NODE_CLASS_MAPPINGS = { + "LayerUtility: ColorName": LS_ColorName, +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "LayerUtility: ColorName": "LayerUtility: Color Name" +} \ No newline at end of file diff --git a/py/get_main_colors.py b/py/get_main_colors.py new file mode 100644 index 0000000..40ff72a --- /dev/null +++ b/py/get_main_colors.py @@ -0,0 +1,88 @@ +from .imagefunc import * + +any = AnyType("*") + +class LS_GetMainColors: + + def __init__(self): + self.NODE_NAME = 'Get Main Colors' + + @classmethod + def INPUT_TYPES(self): + size_list = ['custom'] + size_list.extend(load_custom_size()) + k_means_algorithm_list = ["lloyd", "elkan"] + return { + "required": { + "image": ("IMAGE", ), # + "k_means_algorithm": (k_means_algorithm_list,), + }, + "optional": { + } + } + + RETURN_TYPES = ("IMAGE", "STRING", "STRING", "STRING", "STRING", "STRING",) + RETURN_NAMES = ("preview_image", "color_1", "color_2", "color_3", "color_4", "color_5",) + FUNCTION = 'get_main_colors' + CATEGORY = '😺dzNodes/LayerUtility' + + def get_main_colors(self, image, k_means_algorithm): + + ret_images = [] + + grid_width = 512 + grid_height = 128 + line_width = 5 + + for i in range(len(image)): + pil_img = tensor2pil(torch.unsqueeze(image[i], 0)).convert("RGB") + blured_image = gaussian_blur(pil_img, (pil_img.width + pil_img.height) // 400) + + accuracy = 60 # Adjusts accuracy by changing number of iterations of the K-means algorithm + num_colors = 5 + num_iterations = int(512 * (accuracy / 100)) + original_colors = self.interrogate_colors( + pil2tensor(blured_image), num_colors=num_colors, algorithm=k_means_algorithm, mix_iter=num_iterations, random_state=0) + + main_colors = self.ndarrays_to_colorhex(original_colors) + log(f"main_colors={main_colors}") + # draw colors image + ret_image = Image.new('RGB', size=(grid_width, grid_height * len(main_colors)), color="white") + draw = ImageDraw.Draw(ret_image) + + for j in range(len(main_colors)): + x1 = 0 + y1 = grid_height * j + draw.rectangle((x1, y1, x1 + grid_width, y1 + grid_height), fill=main_colors[j], outline=main_colors[j]) + ret_images.append(pil2tensor(ret_image)) + + log(f"{self.NODE_NAME} Processed {len(ret_images)} image(s).", message_type='finish') + return (torch.cat(ret_images, dim=0), main_colors[0], main_colors[1], main_colors[2], main_colors[3], main_colors[4],) + + def ndarrays_to_colorhex(self, colors:list) -> list: + return [RGB_to_Hex((int(color[0]), int(color[1]), int(color[2]))) for color in colors] + + def interrogate_colors(self, image:torch.Tensor, num_colors:int, algorithm:str, mix_iter:int, random_state:int) -> list: + from sklearn.cluster import KMeans + pixels = image.view(-1, image.shape[-1]).numpy() + colors = ( + KMeans( + n_clusters=num_colors, + algorithm=algorithm, + max_iter=mix_iter, + random_state=random_state, + ) + .fit(pixels) + .cluster_centers_ + * 255 + ) + return colors + + +NODE_CLASS_MAPPINGS = { + "LayerUtility: GetMainColors": LS_GetMainColors +} + +NODE_DISPLAY_NAME_MAPPINGS = { + "LayerUtility: GetMainColors": "LayerUtility: Get Main Colors" +} \ No newline at end of file diff --git a/py/imagefunc.py b/py/imagefunc.py index cdb6fd1..1cfd9c4 100644 --- a/py/imagefunc.py +++ b/py/imagefunc.py @@ -1722,7 +1722,6 @@ def mask_white_area(mask:Image, white_point:int) -> float: '''Color Functions''' - def color_balance(image:Image, shadows:list, midtones:list, highlights:list, shadow_center:float=0.15, midtone_center:float=0.5, highlight_center:float=0.8, shadow_max:float=0.1, midtone_max:float=0.3, highlight_max:float=0.2, @@ -1765,7 +1764,6 @@ def color_balance(image:Image, shadows:list, midtones:list, highlights:list, return tensor2pil(img_copy) - def RGB_to_Hex(RGB:tuple) -> str: color = '#' for i in RGB: @@ -1798,7 +1796,6 @@ def Hex_to_HSV_255level(inhex:str) -> list: HSV = rgb_to_hsv(RGB[0] / 255.0, RGB[1] / 255.0, RGB[2] / 255.0) return [int(x * 255) for x in HSV] - def HSV_255level_to_Hex(HSV: list) -> str: if len(HSV) != 3 or any((not isinstance(v, int) or v < 0 or v > 255) for v in HSV): raise ValueError('Invalid HSV values, each value should be an integer between 0 and 255') @@ -1813,6 +1810,16 @@ def HSV_255level_to_Hex(HSV: list) -> str: return '#' + hex_r + hex_g + hex_b +# 返回补色色值 +def complementary_color(color: str) -> str: + color = Hex_to_RGB(color) + return RGB_to_Hex((255 - color[0], 255 - color[1], 255 - color[2])) + +# 返回颜色对应灰度值 +def rgb2gray(color:str)->int: + (r, g, b) = Hex_to_RGB(color) + return int((r * 299 + g * 587 + b * 114) / 1000) + '''Value Functions''' def is_valid_mask(tensor:torch.Tensor) -> bool: return not bool(torch.all(tensor == 0).item()) diff --git a/py/xy2percent.py b/py/xy2percent.py index 048d74b..11bc64f 100644 --- a/py/xy2percent.py +++ b/py/xy2percent.py @@ -20,7 +20,7 @@ class XYtoPercent: } RETURN_TYPES = ("FLOAT", "FLOAT",) - RETURN_NAMES = ("x_percent", "x_percent",) + RETURN_NAMES = ("x_percent", "y_percent",) FUNCTION = 'xy_to_percent' CATEGORY = '😺dzNodes/LayerUtility/Data' diff --git a/pyproject.toml b/pyproject.toml index fac6a47..256b017 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,9 @@ [project] name = "comfyui_layerstyle" description = "A set of nodes for ComfyUI it generate image like Adobe Photoshop's Layer Style. the Drop Shadow is first completed node, and follow-up work is in progress." -version = "1.0.55" +version = "1.0.56" license = "MIT" -dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "opencv-contrib-python", "pymatting", "segment_anything", "timm", "addict", "yapf", "colour-science", "wget", "mediapipe", "loguru", "typer_config", "fastapi", "rich", "google-generativeai", "diffusers", "omegaconf", "tqdm", "transformers", "kornia", "image-reward", "ultralytics", "blend_modes", "blind-watermark", "qrcode", "pyzbar", "transparent-background", "huggingface_hub", "accelerate", "bitsandbytes", "torchscale", "wandb", "hydra-core", "psd-tools", "inference-cli[yolo-world]", "inference-gpu[yolo-world]", "onnxruntime"] +dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "scikit_learn", "opencv-contrib-python", "pymatting", "segment_anything", "timm", "addict", "yapf", "colour-science", "wget", "mediapipe", "loguru", "typer_config", "fastapi", "rich", "google-generativeai", "diffusers", "omegaconf", "tqdm", "transformers", "kornia", "image-reward", "ultralytics", "blend_modes", "blind-watermark", "qrcode", "pyzbar", "transparent-background", "huggingface_hub", "accelerate", "bitsandbytes", "torchscale", "wandb", "hydra-core", "psd-tools", "inference-cli[yolo-world]", "inference-gpu[yolo-world]", "onnxruntime"] [project.urls] Repository = "https://github.com/chflame163/ComfyUI_LayerStyle" diff --git a/requirements.txt b/requirements.txt index b1d4aa2..6766372 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ torch matplotlib Scipy scikit_image +scikit_learn opencv-contrib-python pymatting segment_anything diff --git a/workflow/get_main_color_and_color_name_example.json b/workflow/get_main_color_and_color_name_example.json new file mode 100644 index 0000000..90f46b1 --- /dev/null +++ b/workflow/get_main_color_and_color_name_example.json @@ -0,0 +1,488 @@ +{ + "last_node_id": 41, + "last_link_id": 61, + "nodes": [ + { + "id": 17, + "type": "LayerUtility: GetMainColors", + "pos": { + "0": 660, + "1": 320 + }, + "size": { + "0": 311.9536437988281, + "1": 158 + }, + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 28 + } + ], + "outputs": [ + { + "name": "preview_image", + "type": "IMAGE", + "links": [ + 46 + ], + "slot_index": 0, + "shape": 3 + }, + { + "name": "color_1", + "type": "STRING", + "links": [], + "slot_index": 1, + "shape": 3 + }, + { + "name": "color_2", + "type": "STRING", + "links": [ + 48, + 55 + ], + "slot_index": 2, + "shape": 3 + }, + { + "name": "color_3", + "type": "STRING", + "links": [], + "slot_index": 3, + "shape": 3 + }, + { + "name": "color_4", + "type": "STRING", + "links": [], + "slot_index": 4, + "shape": 3 + }, + { + "name": "color_5", + "type": "STRING", + "links": [], + "slot_index": 5, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "LayerUtility: GetMainColors" + }, + "widgets_values": [ + "lloyd" + ], + "color": "rgba(38, 73, 116, 0.7)" + }, + { + "id": 38, + "type": "LayerUtility: SimpleTextImage", + "pos": { + "0": 1400, + "1": 490 + }, + "size": [ + 333.2885159321711, + 364.1828329417617 + ], + "flags": {}, + "order": 5, + "mode": 0, + "inputs": [ + { + "name": "size_as", + "type": "*", + "link": 53 + }, + { + "name": "text", + "type": "STRING", + "link": 54, + "widget": { + "name": "text" + } + }, + { + "name": "text_color", + "type": "STRING", + "link": 55, + "widget": { + "name": "text_color" + } + } + ], + "outputs": [ + { + "name": "image", + "type": "IMAGE", + "links": [ + 60 + ], + "shape": 3, + "slot_index": 0 + }, + { + "name": "mask", + "type": "MASK", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "LayerUtility: SimpleTextImage" + }, + "widgets_values": [ + "text", + "Alibaba-PuHuiTi-Heavy.ttf", + "center", + 80, + 8, + 400, + "#FFFFFF", + 0, + "#FF8000", + 0, + 0, + 512, + 512 + ], + "color": "rgba(38, 73, 116, 0.7)" + }, + { + "id": 40, + "type": "PreviewImage", + "pos": { + "0": 2160, + "1": 410 + }, + "size": [ + 697.0121532340336, + 405.5093656051548 + ], + "flags": {}, + "order": 7, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 61 + } + ], + "outputs": [], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 12, + "type": "LoadImage", + "pos": { + "0": 240, + "1": 420 + }, + "size": [ + 369.854603490381, + 334.3001040695102 + ], + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 28, + 53, + 59 + ], + "slot_index": 0, + "shape": 3 + }, + { + "name": "MASK", + "type": "MASK", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "LoadImage" + }, + "widgets_values": [ + "3840x2160car.jpg", + "image" + ] + }, + { + "id": 37, + "type": "PreviewImage", + "pos": { + "0": 660, + "1": 530 + }, + "size": [ + 313.2302664167988, + 331.1310906195131 + ], + "flags": {}, + "order": 2, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 46 + } + ], + "outputs": [], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 41, + "type": "LayerStyle: DropShadow V2", + "pos": { + "0": 1780, + "1": 490 + }, + "size": { + "0": 315, + "1": 266 + }, + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [ + { + "name": "background_image", + "type": "IMAGE", + "link": 59 + }, + { + "name": "layer_image", + "type": "IMAGE", + "link": 60 + }, + { + "name": "layer_mask", + "type": "MASK", + "link": null + } + ], + "outputs": [ + { + "name": "image", + "type": "IMAGE", + "links": [ + 61 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "LayerStyle: DropShadow V2" + }, + "widgets_values": [ + true, + "normal", + 50, + 25, + 25, + 6, + 18, + "#000000" + ], + "color": "rgba(20, 95, 121, 0.7)" + }, + { + "id": 30, + "type": "ShowText|pysssss", + "pos": { + "0": 1410, + "1": 350 + }, + "size": [ + 320.67863272622117, + 76 + ], + "flags": {}, + "order": 4, + "mode": 0, + "inputs": [ + { + "name": "text", + "type": "STRING", + "link": 35, + "widget": { + "name": "text" + } + } + ], + "outputs": [ + { + "name": "STRING", + "type": "STRING", + "links": null, + "shape": 6 + } + ], + "properties": { + "Node name for S&R": "ShowText|pysssss" + }, + "widgets_values": [ + "", + "bubblegum pink" + ] + }, + { + "id": 25, + "type": "LayerUtility: ColorName", + "pos": { + "0": 1026, + "1": 354 + }, + "size": { + "0": 315, + "1": 82 + }, + "flags": {}, + "order": 3, + "mode": 0, + "inputs": [ + { + "name": "color", + "type": "STRING", + "link": 48, + "widget": { + "name": "color" + } + } + ], + "outputs": [ + { + "name": "color_name", + "type": "STRING", + "links": [ + 35, + 54 + ], + "slot_index": 0, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "LayerUtility: ColorName" + }, + "widgets_values": [ + "#000000", + "xkcd" + ], + "color": "rgba(38, 73, 116, 0.7)" + } + ], + "links": [ + [ + 28, + 12, + 0, + 17, + 0, + "IMAGE" + ], + [ + 35, + 25, + 0, + 30, + 0, + "STRING" + ], + [ + 46, + 17, + 0, + 37, + 0, + "IMAGE" + ], + [ + 48, + 17, + 2, + 25, + 0, + "STRING" + ], + [ + 53, + 12, + 0, + 38, + 0, + "*" + ], + [ + 54, + 25, + 0, + 38, + 1, + "STRING" + ], + [ + 55, + 17, + 2, + 38, + 2, + "STRING" + ], + [ + 59, + 12, + 0, + 41, + 0, + "IMAGE" + ], + [ + 60, + 38, + 0, + 41, + 1, + "IMAGE" + ], + [ + 61, + 41, + 0, + 40, + 0, + "IMAGE" + ] + ], + "groups": [], + "config": {}, + "extra": { + "ds": { + "scale": 0.6830134553650709, + "offset": [ + 91.9153139552357, + 304.8849710151086 + ] + } + }, + "version": 0.4 +} \ No newline at end of file diff --git a/workflow/get_main_color_example.json b/workflow/get_main_color_example.json new file mode 100644 index 0000000..87b8004 --- /dev/null +++ b/workflow/get_main_color_example.json @@ -0,0 +1,462 @@ +{ + "last_node_id": 55, + "last_link_id": 81, + "nodes": [ + { + "id": 37, + "type": "PreviewImage", + "pos": { + "0": 660, + "1": 530 + }, + "size": [ + 313.2302664167988, + 331.1310906195131 + ], + "flags": {}, + "order": 2, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 46 + } + ], + "outputs": [], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 12, + "type": "LoadImage", + "pos": { + "0": 230, + "1": 420 + }, + "size": [ + 369.854603490381, + 334.3001040695102 + ], + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [], + "outputs": [ + { + "name": "IMAGE", + "type": "IMAGE", + "links": [ + 28 + ], + "slot_index": 0, + "shape": 3 + }, + { + "name": "MASK", + "type": "MASK", + "links": null, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "LoadImage" + }, + "widgets_values": [ + "3840x2160car.jpg", + "image" + ] + }, + { + "id": 42, + "type": "LayerUtility: ColorImage V2", + "pos": { + "0": 1156, + "1": 166 + }, + "size": [ + 340.20001220703125, + 130 + ], + "flags": {}, + "order": 3, + "mode": 0, + "inputs": [ + { + "name": "size_as", + "type": "*", + "link": null + }, + { + "name": "color", + "type": "STRING", + "link": 75, + "widget": { + "name": "color" + } + } + ], + "outputs": [ + { + "name": "image", + "type": "IMAGE", + "links": [ + 70 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "LayerUtility: ColorImage V2" + }, + "widgets_values": [ + "custom", + 512, + 512, + "#000000" + ], + "color": "rgba(38, 73, 116, 0.7)" + }, + { + "id": 47, + "type": "PreviewImage", + "pos": { + "0": 1578, + "1": 122 + }, + "size": [ + 210, + 246 + ], + "flags": {}, + "order": 6, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 70 + } + ], + "outputs": [], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 53, + "type": "PreviewImage", + "pos": { + "0": 1580, + "1": 420 + }, + "size": { + "0": 210, + "1": 246 + }, + "flags": {}, + "order": 7, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 77 + } + ], + "outputs": [], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 52, + "type": "LayerUtility: ColorImage V2", + "pos": { + "0": 1150, + "1": 470 + }, + "size": { + "0": 340.20001220703125, + "1": 130 + }, + "flags": {}, + "order": 4, + "mode": 0, + "inputs": [ + { + "name": "size_as", + "type": "*", + "link": null + }, + { + "name": "color", + "type": "STRING", + "link": 78, + "widget": { + "name": "color" + } + } + ], + "outputs": [ + { + "name": "image", + "type": "IMAGE", + "links": [ + 77 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "LayerUtility: ColorImage V2" + }, + "widgets_values": [ + "custom", + 512, + 512, + "#000000" + ], + "color": "rgba(38, 73, 116, 0.7)" + }, + { + "id": 55, + "type": "PreviewImage", + "pos": { + "0": 1580, + "1": 730 + }, + "size": { + "0": 210, + "1": 246 + }, + "flags": {}, + "order": 8, + "mode": 0, + "inputs": [ + { + "name": "images", + "type": "IMAGE", + "link": 80 + } + ], + "outputs": [], + "properties": { + "Node name for S&R": "PreviewImage" + } + }, + { + "id": 54, + "type": "LayerUtility: ColorImage V2", + "pos": { + "0": 1150, + "1": 780 + }, + "size": { + "0": 340.20001220703125, + "1": 130 + }, + "flags": {}, + "order": 5, + "mode": 0, + "inputs": [ + { + "name": "size_as", + "type": "*", + "link": null + }, + { + "name": "color", + "type": "STRING", + "link": 81, + "widget": { + "name": "color" + } + } + ], + "outputs": [ + { + "name": "image", + "type": "IMAGE", + "links": [ + 80 + ], + "shape": 3, + "slot_index": 0 + } + ], + "properties": { + "Node name for S&R": "LayerUtility: ColorImage V2" + }, + "widgets_values": [ + "custom", + 512, + 512, + "#000000" + ], + "color": "rgba(38, 73, 116, 0.7)" + }, + { + "id": 17, + "type": "LayerUtility: GetMainColors", + "pos": { + "0": 660, + "1": 320 + }, + "size": { + "0": 311.9536437988281, + "1": 158 + }, + "flags": {}, + "order": 1, + "mode": 0, + "inputs": [ + { + "name": "image", + "type": "IMAGE", + "link": 28 + } + ], + "outputs": [ + { + "name": "preview_image", + "type": "IMAGE", + "links": [ + 46 + ], + "slot_index": 0, + "shape": 3 + }, + { + "name": "color_1", + "type": "STRING", + "links": [ + 75 + ], + "slot_index": 1, + "shape": 3 + }, + { + "name": "color_2", + "type": "STRING", + "links": [ + 78 + ], + "slot_index": 2, + "shape": 3 + }, + { + "name": "color_3", + "type": "STRING", + "links": [ + 81 + ], + "slot_index": 3, + "shape": 3 + }, + { + "name": "color_4", + "type": "STRING", + "links": [], + "slot_index": 4, + "shape": 3 + }, + { + "name": "color_5", + "type": "STRING", + "links": [], + "slot_index": 5, + "shape": 3 + } + ], + "properties": { + "Node name for S&R": "LayerUtility: GetMainColors" + }, + "widgets_values": [ + "lloyd" + ], + "color": "rgba(38, 73, 116, 0.7)" + } + ], + "links": [ + [ + 28, + 12, + 0, + 17, + 0, + "IMAGE" + ], + [ + 46, + 17, + 0, + 37, + 0, + "IMAGE" + ], + [ + 70, + 42, + 0, + 47, + 0, + "IMAGE" + ], + [ + 75, + 17, + 1, + 42, + 1, + "STRING" + ], + [ + 77, + 52, + 0, + 53, + 0, + "IMAGE" + ], + [ + 78, + 17, + 2, + 52, + 1, + "STRING" + ], + [ + 80, + 54, + 0, + 55, + 0, + "IMAGE" + ], + [ + 81, + 17, + 3, + 54, + 1, + "STRING" + ] + ], + "groups": [], + "config": {}, + "extra": { + "ds": { + "scale": 0.9090909090909091, + "offset": [ + 45.96540063613157, + 141.2842631072875 + ] + } + }, + "version": 0.4 +} \ No newline at end of file