Nodes/ComfyUI_Mira/PngColor Masks to List
ComfyUI Node

PngColor Masks to List

All your layout colors as HEX, in one shot

By mirabarukaso·Created 2 years ago·Updated 5 days ago· 206
PngColor Masks to List
  • PngColorMasks
  • mask_color_0
  • mask_color_1
  • mask_color_2
  • mask_color_3
  • mask_color_4
  • mask_color_5
  • mask_color_6
  • mask_color_7
  • mask_color_8
  • mask_color_9
Start_At_Index0

This is the batch version of PngColorMasksToString. Instead of pulling one block's hex color at a time, it reads a whole run of blocks from your Mira PNG mask and hands back up to ten hex strings at once - #FF00FF, #00FF00, and so on down the line. If your layout has five or six regions and you're keying each one by color, this saves you from stamping down six copies of the single-index node.

The context, briefly, in case you landed here cold: regional prompting slices the canvas into areas so multiple subjects stop swapping attributes - the persistent bleed problem that no amount of prompt tweaking fixes on a single global prompt. The Mira Create PNG Mask nodes draw those areas as flat color blocks and emit a PngColorMasks color list. When your downstream conditioning node identifies regions by hex color (Inspire Pack's Regional Conditioning by Color Mask is the usual one), you need those colors as strings. This node produces the whole set.

How it works

The color list is a legend mapping each region to an RGB color. This node walks that legend starting at your Start_At_Index and formats each entry into a #RRGGBB string, filling the numbered outputs in order. Pure lookup-and-format, ten times over. Only as many outputs as you have blocks get populated; the rest stay empty.

The inputs that matter

  • PngColorMasks - the color list from a Mira Create PNG Mask node. The source.
  • Start_At_Index - where to begin, zero-based (it accepts up to 256). Set it to 0 for the whole layout, or bump it to skip leading blocks you're handling separately, like a background region.

The outputs

Ten STRING sockets, mask_color_0 through mask_color_9, each a hex code. Wire each into the color input of a separate Inspire color-mask conditioning node - one per region. It's the fan-out you'd otherwise build by hand.

Installing it

Install the pack. ComfyUI Manager: Manager -> Custom Nodes Manager, search ComfyUI_Mira, Install, restart. Or clone:

cd ComfyUI/custom_nodes
git clone https://github.com/mirabarukaso/ComfyUI_Mira.git

Restart. On a load error, pip install -r requirements.txt inside the folder, then restart again. No downloads for the mask nodes.

Common issues

Ten is the ceiling. A layout with more than ten regions won't fully unpack through this node - if you're running that many areas, you're in unusual territory and should reconsider whether the composition really needs it (regional prompting gets fiddly fast past a handful of regions). For most two-to-six character setups, ten outputs is plenty.

The author himself flags the awkwardness in the README - ComfyUI lacks a clean list-of-strings primitive, so you get numbered sockets instead of one tidy list. It works; it's just visually busy. Live with it.

And the standard reminder for this whole route: only use the string path if your conditioning node wants hex colors. If it takes a MASK, use PngColorMasksToMaskList and skip the color detour. ComfyUI_Mira is a niche solo pack (its author is better known for the WAI Character Select app), so forum help is thin - the README's regional-conditioning example is the map for how these pieces connect.

CategoryMira/Mask

Inputs (2)

NameTypeDefaultDescription
PngColorMasksMIRA_COLOR_LIST
Start_At_IndexINT00–256

Outputs (10)

NameTypeDescription
mask_color_0STRING
mask_color_1STRING
mask_color_2STRING
mask_color_3STRING
mask_color_4STRING
mask_color_5STRING
mask_color_6STRING
mask_color_7STRING
mask_color_8STRING
mask_color_9STRING