Nodes/comfyui_bmad_nodes/ColorDictionary
ComfyUI Node Runs on cloud

ColorDictionary

A ready-made palette of named colors for the CV nodes

By bmad4ever·Created 3 years ago·Updated 9 months ago· 70
ColorDictionary
    • COLOR_DICT
    number_of_colors8

    This node is tiny and slightly boring, and that's fine - its whole job is to hand other nodes a COLOR_DICT. In the comfyui_bmad_nodes pack, a color dictionary is a dict of name → (R, G, B) pairs, and a handful of the color-analysis CV nodes (like FindComplementaryColor) want exactly that as input. ColorDictionary is the lazy way to get one: it serves up a fixed set of standard named colors and you just choose how many you want.

    The set, in order: red, green, blue, white, black, yellow, cyan, magenta, purple, teal, orange, pink. Twelve named colors, hardcoded by the author.

    How it works

    The only input is number_of_colors, an INT from 2 to 12 (default 8). The node simply slices that many entries off the front of its hardcoded list and returns them as a COLOR_DICT. There's no math, no image involved, nothing to tune. Want the classic eight? Leave it at 8. Need orange and pink in the mix too? Crank it to 12.

    The single output, COLOR_DICT, plugs into the pack's color-analysis nodes - FindComplementaryColor is the main one, which takes an image, a color dict, and a power and returns the best-matching color plus its name. So the actual workflow this feeds is: give the analyzer a small palette via ColorDictionary, it scans your image, and tells you which of your named colors is dominant or complementary.

    Why you'd reach for it

    Honestly? Only if you're already in this pack's CV color workflows. If you never touch FindComplementaryColor or the other color-analysis nodes, this one will sit unused in your node list forever, which is fine. It exists because the analysis nodes need a named palette - the color names come out alongside the RGB values, and a plain COLOR list doesn't carry names. If you want different colors than the standard twelve, use ColorDictionary (custom), the sibling that builds a dict from whatever names and colors you supply.

    One quirk worth knowing: the default list is capped at twelve, so number_of_colors maxes at 12 and the slice is always taken from the front. If you need "brown" you'll be disappointed - brown and gray are actually commented out in the source, so they're not available at all. That's what the custom node is for.

    Install

    Part of comfyui_bmad_nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bmad4ever/comfyui_bmad_nodes
    cd comfyui_bmad_nodes
    pip install -r requirements.txt
    

    or install the pack via ComfyUI Manager and restart. No models, no downloads beyond the pack's shared requirements (opencv-python, scikit-image, gray2color, simpleeval).

    Think of it as the "load a palette" convenience node in a chain you'd otherwise have to hand-build. Not exciting - but it keeps a named-color palette one click away.

    CategoryBmad/CV/Color A.

    Inputs (1)

    NameTypeDefaultDescription
    number_of_colorsINT82–12

    Outputs (1)

    NameTypeDescription
    COLOR_DICTCOLOR_DICT