Palette Formatter
Ship a palette out as GIMP, CSS, hex, or Amiga C code
- palette
- formatted_text
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:
rgb→rgb(255, 128, 0)per colorhex→#FF8000raw→ Python tuple(255, 128, 0)gimp→ fullGIMP Paletteheader plus255 128 0 Namelinescss→--color-0: #FF8000;linesamiga→ 4-bit#F00text or0x0F00C 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, defaultrgb.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.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| palette | PIXEL_PALETTE | — | |
| format_type | COMBO | rgb | 6 options: rgb, hex, raw, gimp, css, amiga |
| separatoropt | STRING | — | |
| include_headeropt | BOOLEAN | true | — |
| include_namesopt | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| formatted_text | STRING | — |