Studio Yotsuba
Back to Node List

Palette Swap

palette_swap

Remaps image colors from one palette to another

Reviewed
Guide available

Input Ports

NameTypeDescription
Image
input
Image
Required
Image to recolor
Source Palette
source_palette
Palette
Required
Palette to match against
Target Palette
target_palette
Palette
Required
Palette to replace into

Output Ports

NameTypeDescription
Image
output
Image
Recolored image

Parameters

NameTypeDefaultRangeDescription / Options
Mode
mode
Enum
Exact—

Color matching mode

  • ExactExact
    Replace only exact palette matches
  • NearestNearest
    Replace by the closest source palette color
Preserve Alpha
preserve_alpha
Bool
true—

Keep the original alpha channel

What is it for?

  • Change the color scheme without changing the shading
  • Batch-produce color variants for characters or weapons
  • Recolor existing images to match a theme color

Overview

Recolors an image using the rule "color N in the source palette → color N in the replacement palette." This is the primary node for batch-producing color variants. Because shading structure remains completely intact, a prepared palette is enough to create enemy variants or material changes such as iron → gold.

Usage tips

  • The standard setup: collect the source palette with palette_extract(Exact) → build a new scheme in the same order with palette_create → replace it here. Everything depends on matching the order of both palettes.
  • For batch production, prepare several replacement palettes and send them through batch_render, or mechanically generate hue variants from the source palette with palette_adjust_hsv.
  • For already-quantized pixel art, Exact is the only necessary choice: strict and safe. Use Nearest only for assets whose anti-aliasing or transparency shifts colors slightly.

Common pitfalls

  • Some colors do not change: in Exact, colors do not match exactly; a difference of one value still fails. Align the image to the source palette first with palette_quantize, or use Nearest.
  • Mappings shift and break the scheme: both palettes map from their first entry in order. If lengths differ, only the shorter length is used. Match order and length.
  • Only one color needs changing: color_select_replace is simpler when a palette is unnecessary.

Finding colors

  • Exact
    • Replaces only colors that exactly match the source palette.
    • Best for strict pixel-art recoloring.
  • Nearest
    • Finds and replaces with the nearest source-palette color.
    • Useful when slightly shifted colors should map to nearby entries.

Notes

  • Source and replacement palettes map in order from their first entries.
  • If one is longer, only entries up to the shorter length are used.
  • In Exact, unmatched colors remain unchanged.

Examples

  1. Replace a red character scheme with a blue one.
  2. Build a source palette with Palette Extract and convert to another theme palette.
  3. Replace only a weapon's metal colors with another metal set.
  4. Recolor a translucent asset while preserving opacity with preserve_alpha = true.

Related nodes

  • palette_extract — collect the source palette, the go-to upstream step
  • palette_adjust_hsv / palette_adjust_oklch — generate replacement palettes mechanically
  • color_select_replace — replace only one or two colors
  • common_palette_ref + indexed color — index-based color management across a project
Back to Node List