Color to image
Turn one color into a labeled swatch you can actually see
- color
- image
The whole Pixel Palette Art pack has a visibility problem, and Color to image is the fix for single colors. Everything in this pack operates on PIXEL_COLOR and PIXEL_PALETTE objects, which are in-memory Python types - ComfyUI can't just draw them for you. Color to image renders one color as an actual IMAGE tensor with its hex (or rgb/hsl/css) label stamped on it, so you can preview it, save it, or wire it into a comparison workflow. It's the single-color sibling of Palette View.
You'll want it in two situations. First, sanity-checking: you mix two colors in HSV, and you want to actually see what came out before you build a whole palette around it. Second, documentation: generate a labeled swatch image of a brand color or a palette entry you're about to use in a project, and drop it straight into an image comparison or save it with a standard image node.
How it works
The node builds a PIL image of your chosen width × height, fills it with the color, then draws the formatted text on top using ImageFont.load_default(). The neat touch is text_color: auto, which computes luminance and picks black on light colors, white on dark ones - so #FFFF00 gets black text and #000080 gets white text. text_position places the label top, center, or bottom.
If you set background_color to anything other than transparent, it's drawn behind the swatch (hex or "rgb(...)" strings are accepted; unknown strings fall back to white). Text rendering respects your text_format choice and the text_size slider.
One detail worth knowing: the output is a plain IMAGE in [batch, height, width, channels], so it plays nice with every standard image node. show_text defaults to on, so if you just want a pure color block, flip it off.
Inputs and outputs
Required:
color(PIXEL_COLOR) - the color to render.width/height(64–1024, default 256 each).
Optional:
show_text(bool, default true),text_format(hex/rgb/hsl/css),text_color(black/white/auto),text_size(12–72),text_position(center/bottom/top),background_color(string, defaulttransparent).
Output: image, a standard IMAGE tensor - wire it into PreviewImage or any save node.
Installing
Part of the Pixel Palette Art pack. ComfyUI Manager → "Pixel Palette Art", or:
cd ComfyUI/custom_nodes
git clone https://github.com/ranska/pixel_palette_art.git
Restart ComfyUI, find it under pixel_art/output. Only Pillow is needed - no models, nothing heavy.
Common issues
If you pipe in a color and get a red error image out, the input wasn't a PIXEL_COLOR (the node falls back to a red block on invalid input). The css text format derives the variable name from the color's name, so an unnamed color renders as --color. And remember: preview isn't persistence. The image output is what you save - if you want the palette preserved across a reload, you rebuild it from its source nodes, because PIXEL_COLOR values don't survive in saved workflow JSON.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| color | PIXEL_COLOR | — | |
| width | INT | 25664–1024 | Largeur de l'image |
| height | INT | 25664–1024 | Hauteur de l'image |
| show_textopt | BOOLEAN | true | — |
| text_formatopt | COMBO | hex | 4 options: hex, rgb, hsl, css |
| text_coloropt | COMBO | auto | 3 options: black, white, auto |
| text_sizeopt | INT | 2412–72 | Taille de la police |
| text_positionopt | COMBO | center | 3 options: center, bottom, top |
| background_coloropt | STRING | transparent | Couleur de fond (hex, rgb, ou 'transparent') |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |