Nodes/Pixel Palette Art/Color to image
ComfyUI Node

Color to image

Turn one color into a labeled swatch you can actually see

By ranska·Created about a year ago·Updated 7 months ago· 1
Color to image
  • color
  • image
width256
height256
show_texttrue
text_formathex
text_colorauto
text_size24
text_positioncenter
background_colortransparent

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, default transparent).

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.

Categorypixel_art/output

Inputs (9)

NameTypeDefaultDescription
colorPIXEL_COLOR
widthINT25664–1024Largeur de l'image
heightINT25664–1024Hauteur de l'image
show_textoptBOOLEANtrue
text_formatoptCOMBOhex4 options: hex, rgb, hsl, css
text_coloroptCOMBOauto3 options: black, white, auto
text_sizeoptINT2412–72Taille de la police
text_positionoptCOMBOcenter3 options: center, bottom, top
background_coloroptSTRINGtransparentCouleur de fond (hex, rgb, ou 'transparent')

Outputs (1)

NameTypeDescription
imageIMAGE