Nodes/Comfyui_PDuse/PDJSON_Group
ComfyUI Node

PDJSON_Group

Batch-edit the group colors and titles across a folder of workflows

By 7BEII·Created 2 years ago·Updated 15 days ago· 53
PDJSON_Group
    • Result
    directory_pathA:\path\to\json_files
    color_choiceNone
    modify_sizedisable
    font_size14
    target_title
    output_folder
    new_filename_fix01

    ComfyUI lets you group nodes into labeled, color-coded boxes so a big graph stays readable. But when you've got a hundred workflow files and you want every "SDXL pipeline" group in all of them to be the same color and the same title, doing it by hand is a weekend project. PDJSON_Group automates that: point it at a folder of workflow JSONs and it rewrites the group colors (and optionally font sizes) in every file, saving fixed-up copies with a new filename suffix. It's the workflow-housekeeping sibling of PDJSON_BatchJsonIncremental in the same pack.

    How it works

    It scans directory_path for .json files, and for each one it walks the groups array - ComfyUI serializes groups with a title, a color, and a font_size. Two edits are on offer:

    • color_choice - maps a friendly name to a hex color: Blue #3f789e, DeepGray #444, Yellow #c09430, Green #3c763d, or None to skip recoloring. Every group in every file gets painted the same color.
    • modify_size - when enabled, sets font_size on groups. Here target_title becomes a filter: leave it empty and every group's font size changes; fill it in and only groups with that exact title get resized. Nice if you only want to bump the size of your "Upscale" groups, say.

    Each file is saved to output_folder with the author's suffix appended to the name - default _fix01, so my_workflow.json becomes my_workflow_fix01.json. Originals are left alone, and if a file had nothing to change, it's skipped rather than duplicated.

    The inputs

    • directory_path - source folder. Default is a literal A:\path\to\json_files; replace it.
    • color_choice - the four colors plus None.
    • modify_size - enable/disable font-size editing.
    • font_size - 8–72, default 14.
    • target_title - optional title filter for font-size edits.
    • output_folder - where fixed files land; empty means "same folder as input."
    • new_filename - the suffix appended to output names.

    Result is a STRING report of what changed - how many files, which color, what got resized. Show it with a text node.

    Installing

    ComfyUI Manager, search Comfyui_PDuse; or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/7BEII/Comfyui_PDuse
    cd Comfyui_PDuse
    pip install -r requirements.txt
    

    Restart. No models - it's text/JSON manipulation only.

    Gotchas

    The usual PDuse pack caveats apply: Chinese README, Windows-flavored default paths you must override. The grouping edits assume the standard ComfyUI workflow format (groups with title/color/font_size keys) - API-format prompts and hand-rolled JSON won't have them and will be skipped. color_choice paints all groups the same color, so it's for uniform visual schemes, not per-group differentiation. And the title filter only affects font-size edits, not color - color is all-or-nothing across the file. If you mostly just want consistent, recognizable group styling across a library of workflows, this is a genuinely handy little batch tool; if your workflows are one-offs, it's solving a problem you don't have.

    CategoryPD Custom Nodes

    Inputs (7)

    NameTypeDefaultDescription
    directory_pathSTRINGA:\path\to\json_files
    color_choiceCOMBONone5 options: Blue, DeepGray, Yellow, Green, None
    modify_sizeCOMBOdisable2 options: enable, disable
    font_sizeINT148–72
    target_titleSTRING
    output_folderSTRING
    new_filenameSTRING_fix01

    Outputs (1)

    NameTypeDescription
    ResultSTRING