mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-16 08:22:36 +08:00
Case-insensitive color names
This commit is contained in:
parent
23a93b40f3
commit
29bbe8e2e4
@ -163,7 +163,7 @@ class QuantizePalette:
|
|||||||
return {
|
return {
|
||||||
"required": {
|
"required": {
|
||||||
"image": ("IMAGE",),
|
"image": ("IMAGE",),
|
||||||
"palette": ("STRING", {"default": "#000000, #ffffff", "multiline": True}),
|
"palette": ("STRING", {"default": "black, white", "multiline": True}),
|
||||||
"dither": (["none", "floyd-steinberg"],),
|
"dither": (["none", "floyd-steinberg"],),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ class QuantizePalette:
|
|||||||
|
|
||||||
pal_img = Image.new('P', (1, 1))
|
pal_img = Image.new('P', (1, 1))
|
||||||
pal_colors = palette.replace(" ", "")
|
pal_colors = palette.replace(" ", "")
|
||||||
pal_colors = re.findall(fr'#[a-fA-F0-9]{{6}}|\(?\d{{1,3}},\d{{1,3}},\d{{1,3}}\)?|{"|".join(ImageColor.colormap.keys())}', pal_colors)
|
pal_colors = re.findall(fr'#[a-fA-F0-9]{{6}}|\(?\d{{1,3}},\d{{1,3}},\d{{1,3}}\)?|{"|".join(ImageColor.colormap.keys())}', pal_colors, re.IGNORECASE)
|
||||||
pal_colors = list(itertools.chain.from_iterable(map(parse_palette, pal_colors)))
|
pal_colors = list(itertools.chain.from_iterable(map(parse_palette, pal_colors)))
|
||||||
pal_img.putpalette(pal_colors)
|
pal_img.putpalette(pal_colors)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user