Nodes/DJZ-Nodes/String Weights
ComfyUI Node

String Weights

(text:weight) in one node

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 80
String Weights
    • STRING
    text
    weight1.0

    String Weights does one thing: wraps your text in parentheses with a number after a colon. "dramatic lighting" at weight 1.5 becomes (dramatic lighting:1.5). It's the boring but necessary act of prompt emphasis - the (word:1.3) syntax that SDXL users type by hand a thousand times a day - turned into a node so it can be driven by a slider or another node instead of your keyboard.

    How it works

    The implementation is embarrassingly simple, which is a compliment: f"({text}:{weight:.1f})". Your text, a colon, your weight formatted to one decimal place, wrapped in parentheses. weight runs 0 to 10 with a 0.1 step, default 1.0. The node fires when text or weight changes, so no caching weirdness when you scrub the slider.

    Because it wraps the entire input as a single weighted unit, don't hand it a whole prompt and expect per-word weighting. Feed it one word or phrase - "cinematic light" - and keep your multi-word weighting as separate node calls. One node, one emphasis.

    The part most tutorials get wrong

    Here's the thing nobody tells you until you burn an afternoon: the (word:weight) syntax only means something on CLIP-encoded models. On the SDXL lineage - SD 1.5, SDXL, Illustrious, NoobAI, Pony - weights are real attention multipliers. On LLM-encoded models like Flux 2 Klein, Z-Image, Anima, or Krea 2, the syntax is silently discarded; the text encoder wrapper passes disable_weights=True and your carefully weighted phrase is read as plain words.

    So before you use this node, check what encoder your checkpoint is built on. If you're on an SDXL-derived model, String Weights is a legit time-saver. If you're on Flux or a modern LLM-encoded model, it's a no-op, and the honest answer is that weight-based emphasis doesn't transfer to that generation of models at all - you'd lean on natural-language intensity ("extremely dramatic lighting") instead. The pack ships it as part of its Zenkai prompt-engineering suite, but its usefulness is really bounded by which model family you're in.

    Inputs and outputs

    • text - the word/phrase to weight (multiline)
    • weight - the emphasis value (0–10, default 1.0)

    Output: one STRING in (text:weight) form. Wire it into your CLIP Text Encode prompt, or into another StringWeights call for nested emphasis.

    Install

    Part of DJZ-Nodes by Drift Johnson. ComfyUI Manager → "DJZ-Nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MushroomFleet/DJZ-Nodes
    cd DJZ-Nodes
    pip install -r requirements.txt
    

    Restart ComfyUI. Pure Python, no extra deps of its own.

    Gotchas

    Beyond the encoder caveat above: weights below 1.0 de-emphasize, and going much past 1.5–2.0 on SDXL tends to smear the image - the node happily lets you set 10, but the model won't thank you. And remember you're wrapping the whole string, so keep your input tight and single-purpose.

    CategoryCustom-Nodes

    Inputs (2)

    NameTypeDefaultDescription
    textSTRING
    weightFLOAT1.00–10

    Outputs (1)

    NameTypeDescription
    STRINGSTRING