Nodes/RF Nodes/Style from JSON file
ComfyUI Node

Style from JSON file

Style presets from a JSON file — A1111-style prompt templates, minus the UI

By foxtrot-roger·Created 3 years ago·Updated 2 years ago· 2
Style from JSON file
    • positive
    • negative
    style
    prompt{prompt}
    negative_prompt{negative_prompt}
    positive
    negative

    If you came from Automatic1111, you remember styles - a dropdown of named prompt templates (Anime, Cinematic, Watercolor) that wrapped your text in boilerplate. ComfyUI has no built-in equivalent, so Style from JSON file (RF_JsonStyleLoader) builds one: a dropdown populated from JSON files, where each style is a prompt template with a placeholder for your actual prompt. Pick a style, type your subject, and it spits out a positive and negative prompt ready for the CLIP encoders.

    It's a genuinely useful idea that ships with zero example data. The pack clones with no styles bundled, so the dropdown starts empty until you add your own JSON - which is the first thing that confuses people. There's also a quirk in how the placeholder works, so let's walk through it properly.

    How it works

    The node scans its own directory (custom_nodes/comfyui-rf-nodes/nodes/Json/) for .json files at load time. Each file is expected to be a list of objects with three keys: name, prompt, and negative_prompt. All styles across all files get merged into one dropdown, with duplicate names suffixed (_1, _2).

    Each style's prompt is a template, e.g.:

    [
      {
        "name": "Watercolor",
        "prompt": "watercolor of {prompt}, soft washes, paper texture",
        "negative_prompt": "oil paint, {negative_prompt}, harsh edges"
      }
    ]
    

    The prompt input (default "{prompt}") is the search token inside the template, and the optional positive input is the real text that replaces it. So if positive is "a red fox", you get watercolor of a red fox, soft washes, paper texture. Same story for negative_prompt and negative. If a template's prompt field is empty, your positive text passes through untouched.

    The inputs that matter

    • style - the dropdown, populated from your JSON files. If it's empty, add a properly-formatted JSON file and restart.
    • prompt / negative_prompt - the placeholder tokens (defaults {prompt} / {negative_prompt}). Only change these if your templates use different tokens.
    • positive / negative - optional: your actual prompt text, usually wired from a text node. If left empty, the template's own text is what comes out.

    Outputs: positive and negative STRINGs, straight into two CLIPTextEncode nodes.

    The gotchas

    • Validation is strict. Every item must have all three keys - name, prompt, and negative_prompt - or the whole file is rejected with a console warning and loaded as nothing. One missing key kills the file.
    • Changes need a restart. Styles are read when the node is defined, not per-run. Edit the JSON, restart ComfyUI (or at least reload) before the dropdown updates.
    • It reads only its own folder. The JSON has to live in nodes/Json/ inside the pack, not anywhere convenient. That's a design choice, and it's the thing you'll most likely trip over.

    Installing RF Nodes

    No dependencies, no models to download. Via ComfyUI Manager search "RF Nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/foxtrot-roger/comfyui-rf-nodes
    

    Restart ComfyUI. The node is under RF in the menu. Then drop your style JSON into custom_nodes/comfyui-rf-nodes/nodes/Json/ and restart again.

    CategoryRF

    Inputs (5)

    NameTypeDefaultDescription
    styleCOMBO0 options:
    promptSTRING{prompt}
    negative_promptSTRING{negative_prompt}
    positiveoptSTRING
    negativeoptSTRING

    Outputs (2)

    NameTypeDescription
    positiveSTRING
    negativeSTRING