Nodes/ComfyUI-Basic-Math/Boolean Unary | Basic
ComfyUI Node

Boolean Unary | Basic

The one-operator logic node that flips your workflow

By akatz-ai·Created about a year ago·Updated 11 months ago· 16
Boolean Unary | Basic
    • BOOLEAN
    value
    operation

    Sometimes a condition is exactly backwards from what you need. "Run the upscaler when the image is not small," "bypass when the flag is off." Most of the time you handle that by inverting a widget somewhere or restructuring your switch - which is fiddly. BooleanUnary ("Boolean Unary | Basic") exists to flip a boolean in place: one input, one operation, one output.

    You feed it value (a BOOLEAN) and choose an operation from two options: NOT and IDENTITY. NOT is the one you'll actually use - it inverts true to false and vice versa. IDENTITY just passes the value through unchanged, which sounds useless until you remember that sometimes an explicit pass-through makes a graph's intent readable. The output is a single BOOLEAN.

    The inputs that matter

    • value - any boolean wire: a comparison result, a BooleanInput constant, output from BooleanLogic.
    • operation - NOT to invert, IDENTITY to pass through.

    Why you'd reach for it

    Inverting is the forgotten half of conditional logic. A comparison gives you "is X greater than Y," but your workflow usually cares about the opposite. Rather than building a whole extra branch, drop a NOT in front of the value and wire the result into your switch. It's also the natural complement to BooleanLogic's negated operations - with NOT available, you don't need every possible form pre-built.

    One honest note: BooleanLogic already ships NAND, NOR, and XNOR, which fold the inversion in. So BooleanUnary mostly shines when you want to invert a single signal, or when you're reading a workflow and want the inversion to be visually obvious instead of hidden inside an operation name.

    Installing it

    Standard pack install - pure Python, no dependencies, no models:

    cd ComfyUI/custom_nodes
    git clone https://github.com/akatz-ai/ComfyUI-Basic-Math
    

    Restart ComfyUI and it's under Basic Math ➕ → Boolean, listed as "Boolean Unary | Basic". Or use ComfyUI Manager → Install Custom Nodes → search "ComfyUI-Basic-Math".

    The gotchas

    Same boolean socket rule as the rest of the pack: this node wants a real true/false, not a number. If you're inverting the result of a comparison, you're fine - just wire it straight in. If you're inverting a number or a string, run it through ToBool first. And yes, you'll see "Boolean Unary | Basic" in the search - the | Basic suffix is this pack's convention, not a duplicate.

    CategoryBasic Math ➕/Boolean

    Inputs (2)

    NameTypeDefaultDescription
    valueBOOLEAN
    operationCOMBO2 options: NOT, IDENTITY

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEAN