Nodes/Pixel Palette Art/Palette Formatter
ComfyUI Node

Palette Formatter

Ship a palette out as GIMP, CSS, hex, or Amiga C code

By ranska·Created about a year ago·Updated 7 months ago· 1
Palette Formatter
  • palette
  • formatted_text
format_typergb
separator
include_headertrue
include_namestrue

Palette Formatter is the node that takes a palette out of the graph and into the real world. It converts a whole PIXEL_PALETTE into a STRING in six formats - and the last two on that list are the reason this pack is special. You can export a GIMP .gpl file that loads directly into Aseprite or GIMP, a block of CSS custom properties ready to paste into a stylesheet, or - and this is the one nobody else has - Amiga OCS/ECS 12-bit format, both as text and as a ready-to-compile C array of UWORD values.

If you do pixel art, you know the export grind: copy 32 hex values, reformat them by hand, feed them to whatever tool wants them. This node collapses that whole loop into one dropdown. The amiga output alone is worth the install for the demoscene-adjacent crowd - it quantizes each 8-bit channel down to 4 bits (0–15) and emits #F00-style entries or a full UWORD palette[] C array with a #define PALETTE_SIZE. That is a genuinely thoughtful touch.

How it works

The node delegates to PixelPalette.to_formatted_string(), which builds a metadata header (palette name, color count, format, source file) when include_header is on, then runs each color through the exporter for your chosen format_type. Formats:

  • rgbrgb(255, 128, 0) per color
  • hex#FF8000
  • raw → Python tuple (255, 128, 0)
  • gimp → full GIMP Palette header plus 255 128 0 Name lines
  • css--color-0: #FF8000; lines
  • amiga → 4-bit #F00 text or 0x0F00 C entries

separator (default newline) joins entries, and include_names appends names where the format supports them.

Inputs and outputs

  • palette (PIXEL_PALETTE) - what you're exporting.
  • format_type - dropdown, default rgb.
  • separator (STRING, default \n), include_header (bool, default true), include_names (bool, default true).

Output: formatted_text, a single STRING. Route it to any text-display node, or a text-file saver if your pack has one.

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; it's under pixel_art/output. Just Pillow - no downloads.

Common issues

The GIMP format is a full palette file, not one line - that's the gimp export here (single-color GIMP lines are the job of Color Formatter). And note that include_header matters for GIMP: without the GIMP Palette header line, GIMP/Aseprite won't recognize the file when you paste it in. Leave it on.

CSS export names variables by index (--color-0), which is fine for most uses but not human-friendly - if you want semantic names, feed this from the output of Create Gradient Palette or a loader where colors carry names, and turn include_names on. Also: the output is text, so ComfyUI won't show it floating on the canvas; hook a text node up, or you'll think nothing ran.

Categorypixel_art/output

Inputs (5)

NameTypeDefaultDescription
palettePIXEL_PALETTE
format_typeCOMBOrgb6 options: rgb, hex, raw, gimp, css, amiga
separatoroptSTRING
include_headeroptBOOLEANtrue
include_namesoptBOOLEANtrue

Outputs (1)

NameTypeDescription
formatted_textSTRING