LayerUtility: Name To Color
Name To Color — turn a color name like \"cornflower blue\" into a hex value
- size_as
- image
- color
You type a color name, not a hex code, and this node resolves it to an actual color, plus generates a solid swatch image so you can see it. If you've ever typed "sage green" or "cornflower blue" into a prompt and had no real idea what hex value the model was going to land on, this is the reverse-lookup version - useful for building color-driven graphs where you want to work in human language rather than hex codes, or for checking what a given palette actually calls a specific shade.
How it works
It looks the name up against whichever palette you select - a few different standard color-naming systems, each with its own quirks and coverage. css3/css4 and html4 are the web-standard named-color lists (the same ones your browser understands). xkcd is the crowd-sourced color-naming survey - famous for having far more (and far more creative) names than any formal standard, at the cost of being less standardized. wiki_color is Wikipedia's color-name list. flux_sdxl is the odd one out here - a palette apparently tuned to the color vocabulary that shows up in Flux/SDXL-era prompts specifically, which is worth reaching for if you're trying to match what a diffusion model is likely to actually understand by a given color word, rather than what a web CSS spec calls it.
The inputs and outputs that matter
color_name(default "white") - the name to resolve. Case and exact wording matter less than you'd think for the looser palettes (xkcd especially), but stick close to standard names for predictable results.palette- which naming system to check against: xkcd, wiki_color, flux_sdxl, css4, css3, or html4.in_palette_only(default false) - when true, an unrecognized name fails outright instead of falling back; when false, unresolved names fall back todefault_color.default_color(default black) - the fallback hex value when a name doesn't resolve andin_palette_onlyis off.size/custom_width/custom_height- canvas size for the generated swatch, same preset-dropdown-plus-custom pattern as GradientImage V2.size_as(optional) - wire in an upstream image (or a GetImageSize output) to size the swatch to match it instead of using a preset.
Outputs: image (the solid swatch) and color (the resolved hex string) - wire the string into any other color-driven node in the pack.
How to install it
Search ComfyUI Layer Style in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle
pip install -r ComfyUI_LayerStyle/requirements.txt
Restart; find it under 😺dzNodes → LayerColor - note this one lives in a different category than most of this pack's utility nodes.
Common issues
If a name you're sure is valid keeps falling back to default_color, the fix is almost always the palette selection - a name that exists in xkcd's sprawling list might not exist in the much smaller css3 list, and vice versa. Try switching palettes before assuming you typo'd the name. If you specifically want the node to fail loudly on an unrecognized name rather than silently substituting a fallback color (say, you're validating user input), flip in_palette_only on - with it off, a typo just quietly resolves to black (or whatever you set default_color to) and you might not notice for a while.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| color_name | STRING | white | — |
| palette | COMBO | 6 options: xkcd, wiki_color, flux_sdxl, css4, css3, html4 | |
| in_palette_only | BOOLEAN | false | — |
| default_color | STRING | #000000 | — |
| size | COMBO | 10 options: custom, 1024 x 1024, 768 x 512, 512 x 768, 1280 x 720, 720 x 1280, +4 | |
| custom_width | INT | 5124–99999 | — |
| custom_height | INT | 5124–99999 | — |
| size_asopt | * | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| color | STRING | — |