ComfyUI PromptStyler
PromptStyler is a custom ComfyUI node that helps you keep your prompts consistent by applying a selected “style template” to your positive prompt, then outputting CONDITIONING for KSampler.
If you are new to ComfyUI: you can think of CONDITIONING as the “encoded text prompt” that the sampler uses. PromptStyler builds a styled prompt string, encodes it with the model’s text encoder (CLIP), and passes the result to KSampler.
What This Node Does (Exact Behavior)
Node name in ComfyUI:
PromptStyler: Prompt -> Conditioning (Style Picker)
Step-by-step:
- You type a normal prompt in
prompt(your subject + what you want). - You pick one style from the dropdown (the node loads style templates from JSON packs).
- If
apply_styleis enabled:- It builds a new prompt:
style.prefix + your prompt + style.suffix - For
template_variant=default, it merges comma-separated phrases and de-dupes duplicates. - For
template_variant=flux_2_klein, it appends a short prose style guide after your prompt (when available).
- It builds a new prompt:
- It tokenizes and encodes the final prompt using the
text_encoder(CLIP). - It outputs:
positive(CONDITIONING) for KSamplerstyled_prompt(STRING) so you can see the exact final prompt
Important: styles are written to describe style only (medium/process/lighting/palette/texture/composition) and to avoid injecting unrelated objects that you didn’t ask for.
Install (Beginner Friendly)
- Copy or clone this repo into:
ComfyUI/custom_nodes/ComfyUI_PromptStyler/
- Restart ComfyUI (or use Reload custom nodes).
- Confirm the node exists by searching for
PromptStylerin the node menu.
How To Use (Recommended Wiring)
Typical workflow:
- Add
CheckpointLoaderSimple - Add
PromptStyler: Prompt -> Conditioning (Style Picker) - Add
KSampler
Connect:
CheckpointLoaderSimple.CLIP->PromptStyler.text_encoder- Your text ->
PromptStyler.prompt PromptStyler.positive->KSampler.positive
Optional (debugging):
- Use the
styled_promptoutput to verify that the style template is doing what you expect.
Inputs / Outputs (Explained)
Inputs:
prompt(STRING): your prompt text (subject/action/attributes). Works best with comma+space phrases.apply_style(BOOLEAN): when off, PromptStyler passes your prompt through unchanged (still outputs conditioning).style(dropdown): pick one style. Dropdown entries areCategory | Name | id.template_variant:default: uses comma+space “phrase tokens” (best for SD-like prompt token lists).flux_2_klein: uses prose guidance when present (helpful for Flux-like models).
style_id_override(STRING): advanced. If set, the node uses that styleiddirectly (useful right after adding a new style).text_encoder(CLIP): wire this from your checkpoint/model loader.
Outputs:
positive(CONDITIONING): connect to KSamplerpositive.styled_prompt(STRING): the final prompt string used for conditioning.
Style Library (Where Styles Live)
Styles live in JSON packs:
styles/packs/*.json(merged at runtime in filename order)- Legacy fallback (only used if packs are missing):
styles/styles_v1.json
Pack file naming:
- Numeric prefixes control merge order (example:
10_cinema.jsonloads before20_photography.json).
Style entry schema:
{
"id": "unique_snake_case",
"name": "Human Name",
"category": "Category/Subcategory",
"default": { "prefix": "...", "suffix": "..." },
"models": { "flux_2_klein": { "prefix": "", "suffix": "..." } },
"tags": ["tag1", "tag2"]
}
Adding Your Own Styles (No Coding Required)
This repo includes a helper tool that writes a custom pack file (gitignored by default):
- Default user pack:
styles/packs/99_user_custom.json
Wizard (recommended):
C:\Comfyui\python_embeded\python.exe .\tools\add_styles.py wizard
After adding a style:
- Copy the printed
id - Paste it into
style_id_overrideto use it immediately (no ComfyUI reload required)
List categories:
C:\Comfyui\python_embeded\python.exe .\tools\add_styles.py categories
Add a style directly:
C:\Comfyui\python_embeded\python.exe .\tools\add_styles.py add --name "Ink Noir (Modern)" --category "Fine Art" --core "ink wash, chiaroscuro, high contrast" --details "paper texture, soft bleed, dramatic mood" --tags "ink,noir"
Prompting Tips (So Styles Stay Accurate)
- Put subjects/objects in your
prompt(the user input), not in the style template. - Write prompts as comma+space phrases:
", "is the splitter used by the node’s default template mode. - If a style is explicitly specific (its name is a scene/subject), it may include those nouns. Otherwise templates aim to stay subject-agnostic.
Validate / Audit (Recommended Before Editing Packs)
Validate required fields and uniqueness:
C:\Comfyui\python_embeded\python.exe .\tools\validate_styles.py
Optional consistency audit (also flags banned gear terms):
C:\Comfyui\python_embeded\python.exe .\tools\audit_styles.py
Regenerate Curated Packs (For Maintainers)
Curated packs are generated by:
C:\Comfyui\python_embeded\python.exe .\tools\generate_style_packs.py
After regenerating packs, restart ComfyUI (or reload custom nodes) to refresh the dropdown.
Troubleshooting
- Node doesn’t show up:
- Verify the folder path is exactly
ComfyUI/custom_nodes/ComfyUI_PromptStyler/ - Restart ComfyUI or use Reload custom nodes
- Verify the folder path is exactly
- Styles missing or dropdown says “(no styles found)”:
- Check that
styles/packs/*.jsonexists and is valid JSON - Run
.\tools\validate_styles.py
- Check that
- A style feels like it “adds extra objects”:
- Try
template_variant=defaultfirst (token style) - Keep your subject strongly stated in the user
prompt - If you find a template adding unwanted nouns, it should be fixed in the pack (PRs welcome)
- Try
Versioning / GitHub Releases (Preparing v0.3.0)
Source of truth:
- Version:
VERSION(mirrored in__init__.pyas__version__) - Changelog:
CHANGELOG.md(Keep a Changelog)
Suggested release checklist:
- Run
.\tools\validate_styles.pyand.\tools\audit_styles.py(include output in your PR). - Ensure
README.mddescribes new behavior/inputs. - Ensure
CHANGELOG.mdhas the release notes under the new version. - Push to GitHub and let Release Please create the release PR (see
RELEASING.md).