Prompt Color Replace
Turn #color1# tags into actual color names — the node that makes palette prompts work
- prompt
- replacements_log
The whole FVMtools color system works because of one trick: prompts are written with color placeholders, not colors. Outfit Generator emits things like "a #primary# silk blouse, #accent# leather heels." This node is where those tags become real words - "a crimson silk blouse, gold leather heels" - fed by the palette_string from Color Palette Generator or Palette From Image. It's the glue node in the pipeline: generator → this → CLIPTextEncode. Without it, you'd be typing #primary# into your sampler and wondering what went wrong.
What tags it understands
Three families, all case-insensitive:
- Positional:
#color1#through#color8#(short form#c1#–#c8#), mapping to palette positions 1–8. - Semantic roles:
#primary#,#secondary#,#accent#,#neutral#,#metallic#(short forms#pri#,#sec#,#acc#,#neu#,#met#). - Position 1 maps to
#primary#, position 2 to#secondary#, and so on - so a 5-color palette covers all five role tags, and#color6#–#color8#reach the extras.
If a tag references a color that doesn't exist (say #color7# in a 5-color palette), it falls back to fallback_color (default black) rather than erroring out - which is a blessing, but also a silent trap if you weren't expecting the black.
The inputs that matter
prompt- the tag-filled text. Wire theoutfit_promptfrom Outfit Generator here, or type by hand.palette_string- the comma-separated palette. Connect from Color Palette Generator or Palette From Image.primary,secondary,accent,neutral,metallic- optional role overrides that take precedence over the palette positions. This is the fine-tune lane: keep the palette as-is but force#accent#to "emerald" without regenerating anything. Connect the matching role outputs if you want role mapping to be exact rather than positional.strip_hyphens- on by default, converts "navy-blue" to "navy blue". Mostly a model-compatibility thing: SD/SDXL prompt parsers read "navy blue" as two tokens, which is what you usually want. Turn it off if your model was trained on hyphenated colors.
Outputs: the resolved prompt, plus a replacements_log string that lists every tag swap. That log is your debugging friend - glance at it once when a prompt comes back with "black" somewhere you didn't expect and you'll find the missing color instantly.
Installing
Zero dependencies beyond the pack itself:
cd ComfyUI/custom_nodes
git clone https://github.com/ping1979ping/comfyui-FVMtools
Restart ComfyUI. It's a pure string node - no model, no GPU, runs in milliseconds.
The trap
Because replacements are literal string substitution, prompt order and grammar are on you. A tag mid-sentence like "a #primary# colored top" resolves fine, but "the #accent# #primary# hat" resolves to two color names jammed together, which the model will read as one weird blended color. Write templates so each tag sits on its own garment phrase. And remember the fallback: if your Outfit Generator emits #color7# but your palette has 5 colors, you get a black garment unless you fix the tag or the palette size. The replacements_log is the first place to look when a color comes out wrong - it tells you exactly what became what.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | Text with color placeholder tags to replace. Supported tags: #color1# to #color8# (or #c1# to #c8#) — by palette position #primary# #secondary# #accent# #neutral# #metallic# — by role #pri# #sec# #acc# #neu# #met# — short aliases Connect the outfit_prompt from Outfit Generator, or write manually. Tags are case-insensitive. | |
| palette_string | STRING | Comma-separated color names from Color Palette Generator. Position mapping: 1st color = #color1# = #primary# 2nd color = #color2# = #secondary# 3rd color = #color3# = #accent# 4th color = #color4# = #neutral# 5th color = #color5# = #metallic# 6th-8th = #color6# to #color8# Connect palette_string output from Color Palette Generator. | |
| primaryopt | STRING | Override the primary role color. Takes precedence over the palette_string position. Connect from Color Palette Generator's 'primary' output. | |
| secondaryopt | STRING | Override the secondary role color. Takes precedence over the palette_string position. Connect from Color Palette Generator's 'secondary' output. | |
| accentopt | STRING | Override the accent role color. Takes precedence over the palette_string position. Connect from Color Palette Generator's 'accent' output. | |
| neutralopt | STRING | Override the neutral role color. Takes precedence over the palette_string position. Connect from Color Palette Generator's 'neutral' output. | |
| metallicopt | STRING | Override the metallic role color. Takes precedence over the palette_string position. Connect from Color Palette Generator's 'metallic' output. | |
| fallback_coloropt | STRING | black | Color used when a tag has no matching palette color. Default: 'black'. Used if palette has fewer colors than tags referenced. |
| strip_hyphensopt | BOOLEAN | true | Convert hyphenated colors to spaces. ON: navy-blue → navy blue (better for SD/SDXL prompts) OFF: keep navy-blue as-is (useful if your model expects hyphens) |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |
| replacements_log | STRING | — |