Nodes/OpalSky Nodes/StringSwitchOpalSky
ComfyUI Node

StringSwitchOpalSky

The prompt switcher born in a Reddit comment

By OpalSky-AI·Created 2 years ago·Updated 2 years ago· 2
StringSwitchOpalSky
    • concatenated_string
    use_custom_stringstrue
    use_stylesfalse
    string_1
    switch_string_1true
    string_2
    switch_string_2true
    string_3
    switch_string_3true
    string_4
    switch_string_4true
    string_5
    switch_string_5true
    presetCustom
    Lighting_and_Atmospherenone
    Artistic_Medium_and_Texturenone
    Cultural_and_Genre_Influencesnone
    Composition_and_Style_Structurenone
    Photography_and_Realismnone

    This node has an origin story, and it's a good one. In October 2024 someone on r/comfyui asked for a node with a prompt switcher - the ability to toggle whole prompt snippets on and off, Power-Lora-Loader style. The author of this pack answered with "here is my attempt at this node. Feedback is welcome" and dropped a GitHub link. StringSwitchOpalSky is that attempt, shipped essentially unchanged since.

    What you get is five string slots, each with its own on/off toggle. Put a phrase in string_1, flip switch_string_1 on, and it gets included in the output; flip the switch off and the phrase vanishes without you deleting anything. That's the whole core loop, and it's genuinely handy when you're A/B-testing lighting descriptions or toggling an artist tag between runs without rebuilding the prompt.

    The inputs that actually matter:

    • use_custom_strings (default on) and use_styles (default off) - the two master switches.
    • string_1 through string_5, each paired with switch_string_1 through switch_string_5.
    • preset - Custom, Cinematic Noir, Fantasy Illustration, Retro Sci-Fi. A non-Custom preset overrides the style dropdowns with a hardcoded combo.
    • The five style dropdowns (Lighting_and_Atmosphere, Artistic_Medium_and_Texture, Cultural_and_Genre_Influences, Composition_and_Style_Structure, Photography_and_Realism), which only do anything when use_styles is on.

    Enabled custom strings get concatenated first, then the selected style tags if use_styles is on, and everything joins with ", " into a single concatenated_string output. Wire that into a CLIPTextEncode positive input and you're done. Flip both master switches off and you get an empty string - a cheap way to mute the node entirely.

    Installation is the same as its sibling: clone the pack into custom_nodes and restart, or find it in ComfyUI Manager.

    cd ComfyUI/custom_nodes
    git clone https://github.com/OpalSky-AI/OpalSky_Nodes
    

    No dependencies, no model files, nothing to download.

    The gotchas are real, and one of them is a genuine trap. This node reads its style bank from styles.json - lowercase - but the repo ships Styles.json with a capital S. On Linux that load silently fails, so the five style dropdowns come up empty (comfy.icu's schema for this node shows them with zero choices). The good news: custom strings, the toggles, and the presets all still work, because those live in the Python code, not the JSON. Only the style bank is dead. Rename the file to styles.json and it comes back. And yes, the two nodes in this pack read two different JSON files with two different shapes - a sign of how quickly this project came together.

    The honest note: the thread that spawned this pack eventually pointed the asker at rgthree's Power Lora Loader instead, which is the maintained, far more powerful version of exactly this idea. Treat StringSwitchOpalSky as the lightweight learning-project take on it - fine for a workflow you're just playing with today, but if you're building something you'll live with for months, the rgthree route is the one people actually reach for. One harmless quirk: the pack's __init__.py declares a frontend folder that doesn't exist in the repo, so you may see a warning in the console at startup. Ignore it.

    Categorysd

    Inputs (18)

    NameTypeDefaultDescription
    use_custom_stringsBOOLEANtrue
    use_stylesBOOLEANfalse
    string_1STRING
    switch_string_1BOOLEANtrue
    string_2STRING
    switch_string_2BOOLEANtrue
    string_3STRING
    switch_string_3BOOLEANtrue
    string_4STRING
    switch_string_4BOOLEANtrue
    string_5STRING
    switch_string_5BOOLEANtrue
    presetCOMBOCustom4 options: Custom, Cinematic Noir, Fantasy Illustration, Retro Sci-Fi
    Lighting_and_AtmosphereCOMBOnone0 options:
    Artistic_Medium_and_TextureCOMBOnone0 options:
    Cultural_and_Genre_InfluencesCOMBOnone0 options:
    Composition_and_Style_StructureCOMBOnone0 options:
    Photography_and_RealismCOMBOnone0 options:

    Outputs (1)

    NameTypeDescription
    concatenated_stringSTRING