Slime Forge

Guide · pixel art colour variants

How to make palette swaps (colour variants) of pixel-art sprites

Short answer: a palette swap replaces each colour of a sprite with a matching colour from a new palette, so the shapes and shading stay identical while the colours change. The reliable method is to group the sprite's colours into ramps (dark to light) and replace every ramp with a new one of the same length and similar lightness, shifting hue rather than value. You can do it by hand in Aseprite (Edit > Replace Color or an indexed palette edit), LibreSprite, Pixelorama, GIMP or Krita, at runtime with a Godot or Unity shader, or in bulk with a free browser tool such as Palette Swapper.

Updated 29 November 2026 · about 15 minutes to read · for indie game devs and pixel artists making enemy recolours, team colours and skins.

A 16x16 pixel-art slime shown in four palette swaps: original green, red fire, blue ice and purple poison, each with its five-colour ramp underneath. Shapes and shading are identical; only the ramp changes.
One 16×16 sprite, four palette swaps. Only the five body colours change; the eye colours are shared and never swapped.

Why palette swaps work: think in ramps, not in colours

Palette swapping is as old as console sprites: the NES and SNES stored sprites as colour indices plus a small palette, so a "new" enemy cost nothing but a different palette. Modern games use full-colour PNGs, but the idea still saves enormous time: one set of drawings, many characters.

The trick is that a sprite's readability comes from value (lightness) and contrast, not from hue. Your green slime reads as a round, lit blob because its colours step from dark to light in a consistent order. That ordered set is a colour ramp: typically outline → shadow → base → light → highlight.

A good swap therefore keeps each step's lightness roughly where it was and changes the hue (and often saturation). Change the value and the shading breaks: shadows flatten, highlights vanish, or the sprite disappears against your background.

Diagram of four five-step colour ramps (green, red, blue, purple) aligned by role: outline, shadow, base, light, highlight. A bar under each swatch shows its lightness, which stays similar from ramp to ramp.
The four ramps used in the slime above. The bars show approximate perceived lightness: hue changes freely, but each step stays close in value.

Two more ramp habits that pay off in variants:

Prepare your sprite before swapping

Ten minutes of cleanup here saves hours later, whichever tool you use.

  1. Count the colours. A palette swap maps colour A to colour B. If the sprite has 60 colours because of soft brushes, you will have 60 mappings per variant. Aim for 8–24 colours for a typical character.
  2. Remove stray anti-aliasing shades. Near-duplicates (say #4c9a5c and #4d9a5c) look identical but will not be replaced together. Merge them into the intended colour. In Aseprite, the palette's options menu has New Palette from Sprite, which lists what is really used.
  3. Give every material its own ramp. If skin and armour share a tone, recolouring the armour also recolours the face. Separate them now, even if it costs one extra colour.
  4. Order the palette by ramp. Put each ramp's colours next to each other from dark to light. Mapping is then a matter of lining up two rows of swatches.
  5. Save as PNG. Never JPG or lossy WebP for pixel art: compression invents new colours.

Need a starting palette with ramps already built? Slime Forge 16 is a free CC0 16-colour palette (.gpl, .hex and PNG) organised in ramps, and the Lospec palette list has thousands of community palettes you can filter by colour count.

Method 1: Aseprite

Aseprite is the most common paid pixel-art editor (a one-time purchase; its source code is also available if you compile it yourself). It offers two built-in ways to swap colours.

A. Replace Color (quick, one colour at a time)

  1. Duplicate your file or layer so you keep the original (Sprite > Duplicate, or duplicate the layer).
  2. Open Edit > Replace Color (default shortcut Shift+R).
  3. Set From to the original colour and To to the new one. Keep Tolerance at 0 so only exact matches change.
  4. It applies to the current layer/cel, or to the selection if you have one. Select all frames in the timeline first if the sprite is animated and you want every frame changed.
  5. Repeat for each colour of the ramp, darkest to lightest.

B. Indexed mode + palette edit (whole ramps at once)

  1. Convert with Sprite > Color Mode > Indexed. Each pixel now points to a palette entry.
  2. Unlock in-place palette editing with the padlock button above the colour bar.
  3. Double-click a palette entry (or use the colour picker) and change it: every pixel using that index updates on every frame instantly.
  4. Change the whole ramp, then save the palette (palette options menu) as a preset or a .gpl file. Repeat with a new copy for each variant.
  5. Switch back to RGB (Sprite > Color Mode > RGB) if you prefer to keep drawing in RGB.

Tip: Edit > Adjust Colors > Hue/Saturation on a selection is handy for a rough draft of a variant, which you then fix ramp by ramp. And when you paint new frames, the Shading ink walks up and down a ramp you select in the palette, which naturally keeps your sprite "ramp-clean" and easy to swap.

Batch: Aseprite is scriptable in Lua and has community extensions (free and paid on itch.io) that generate one layer or file per palette. Without a script, each variant is a manual repeat.

Method 2: LibreSprite and Pixelorama (free)

LibreSprite is a free, open-source fork of an older open-source Aseprite release, so the workflow above carries over: an indexed colour mode with an editable palette and a replace-colour command. Menus can differ from current Aseprite; look for the same commands under Sprite and Edit.

Pixelorama is a free, open-source editor built with Godot that runs on desktop and in the browser.

  1. Load or create your palette in the Palettes panel (it imports common formats such as .gpl).
  2. For one colour at a time, use the bucket tool set to fill every pixel of the same colour (not only the contiguous area), then click with the new colour.
  3. To force a whole sprite into a target palette, use the Palettize image effect (added in version 1.0), which maps each colour to the nearest colour of the selected palette. Nearest-colour mapping is approximate: check ramps afterwards.

Method 3: GIMP

GIMP is free and has a true indexed mode, which makes it a capable palette-swap tool once set up.

A. Edit the colour map (exact and fast)

  1. Image > Mode > Indexed. Choose Use custom palette or Generate optimum palette with a maximum close to your real colour count, and set dithering to None.
  2. Open the Colormap dialog (Windows > Dockable Dialogs > Colormap).
  3. Double-click a colour entry and type the new hex value. All pixels using that entry change.
  4. Export with File > Export As… to PNG, then repeat on a copy for the next variant.

B. Color Exchange or Rotate Colors (RGB images)

  1. Colors > Map > Color Exchange swaps one source colour for one target colour; keep thresholds at 0 for pixel art.
  2. Colors > Map > Rotate Colors rotates a hue range to another hue range, useful for a quick whole-ramp draft. Like any hue shift, check lightness afterwards.

GIMP can be scripted (Script-Fu or Python plug-ins) for batches, but out of the box each variant is manual.

Method 4: Krita

Krita is free and great for painting, but it has no indexed colour mode, so you work with selections and filters.

  1. Use the Similar Color Selection tool with fuzziness at 0 to select every pixel of one colour (check that anti-aliasing is off in the tool options).
  2. Fill the selection with the new colour (Shift+Backspace fills with the foreground colour), then deselect and repeat.
  3. For a ramp-based recolour of a single-material sprite, try Filter > Map > Gradient Map: it maps lightness to a gradient, so a gradient built from your new ramp recolours the sprite while following its values. Set the gradient to hard (non-blended) stops so you get exact colours, not in-between tones.
  4. Filter > Map > Palettize snaps every pixel to the nearest colour of a chosen palette, useful to clean up after a Gradient Map or a hue adjustment.
  5. Filters can also be used as filter masks or filter layers, so you can keep variants non-destructive and toggle them.

Method 5: in the game engine with a shader (Godot / Unity)

When you need many combinations or runtime choice (team colours, character creators), store one sprite sheet and recolour it on the GPU. There are two common designs.

A. Compare-and-replace with uniform colours (simplest)

The shader compares each pixel with a short list of "from" colours and outputs the matching "to" colour. Fine for 4–8 colours per sprite. Godot 4 example:

shader_type canvas_item;

const int N = 5;
uniform vec4 from_colors[N] : source_color;
uniform vec4 to_colors[N] : source_color;
uniform float tolerance = 0.02;

void fragment() {
    vec4 c = texture(TEXTURE, UV);
    for (int i = 0; i < N; i++) {
        if (distance(c.rgb, from_colors[i].rgb) < tolerance) {
            c.rgb = to_colors[i].rgb;
        }
    }
    COLOR = c;
}

B. Lookup texture (scales to many variants)

Draw the sprite in grey "index" values (index 0, 1, 2… stored in the red channel), and keep a small palette texture where each row is one variant and each column one index. The shader reads the index and fetches the colour. Switching variant is changing one number.

shader_type canvas_item;

uniform sampler2D palette : filter_nearest;  // columns = indices, rows = variants
uniform float palette_size = 8.0;            // number of columns
uniform float variant_count = 4.0;           // number of rows
uniform float variant = 0.0;                 // which row to use

void fragment() {
    vec4 src = texture(TEXTURE, UV);
    float index = floor(src.r * 255.0 + 0.5);
    vec2 uv = vec2((index + 0.5) / palette_size, (variant + 0.5) / variant_count);
    COLOR = vec4(texture(palette, uv).rgb, src.a);
}

Ready-made options exist too, such as MIT-licensed palette-swap shaders in the Godot Asset Library. The same logic works in Unity with Shader Graph or a custom sprite shader.

Engine settings matter: use nearest/point filtering, no mipmaps and no lossy texture compression on both the sprite and the palette texture. Otherwise the GPU blends or alters colours and the compare or index lookup misses pixels.

Method 6: free browser tools and batch export

If you need ten variants of fifteen sprites, doing it by hand in any editor is slow. This is the case our tools are built for, and there are other options too.

Palette Swapper (free, in your browser)

Drop one or several PNG sprites; the tool lists every exact colour they share. Each column is a variant: click a colour to set its replacement, or add a hue-shifted variant as a starting point. You see all variants side by side, then download every variant as PNGs in one ZIP, plus the palettes as .gpl (GIMP, Aseprite, Krita), .hex (Lospec) and a PNG strip. Images are processed locally and never uploaded.

  1. Open Palette Swapper and drop your PNG files.
  2. Click + Variant (or + Hue-shifted variant) and set the new colours ramp by ramp.
  3. Check the preview at 1x and zoomed in; save the project if you want to come back to it.
  4. Click Download all variants (.zip) and Export palettes.
Open Palette Swapper (free)

Palette Swapper MCP (for AI coding agents)

If you build your game with an AI coding agent such as Claude Code, Cursor or Codex, this MCP server lets the agent run the same operations on whole folders of PNGs from your project: colour variants, palette export, palette snapping, outlines, scaling, and sprite sheet slicing and packing with a JSON atlas (9 tools). The full version is 4 € on itch.io; a free Lite version (4 tools, MIT licence) is also available.

Get the MCP server (4 €) See the free Lite version

Other approaches: small "apply a palette" web tools on itch.io map each colour to the nearest colour of a new palette (quick, but nearest-colour matching can merge or swap ramp steps), and if you code, a 20-line Python script with Pillow that maps exact RGB values from a dictionary is a perfectly good batch tool.

Comparison: which palette-swap tool should you use?

ToolPriceMany variants / batchBest for
AsepritePaid, one-time (or compile the source yourself)Manual per variant; batch via Lua scripts or extensionsDaily pixel-art work, animated sprites, indexed palette edits
LibreSpriteFree, open sourceManualAn Aseprite-style workflow on zero budget
PixeloramaFree, open sourceManual; Palettize effect for whole-palette snappingFree editor on desktop or in the browser
GIMPFree, open sourceManual; scriptable with plug-insExact colour-map edits in indexed mode
KritaFree, open sourceManual; reusable filter masksPainters; Gradient Map recolours that follow lightness
Godot / Unity shaderFree (engine)Unlimited at runtime from palette texturesTeam colours, player customisation, many combinations
Palette SwapperFreeYes: many sprites × many variants, one ZIP + .gpl/.hexBaking a set of variants quickly without installing anything
Palette Swapper MCP4 € (Lite: free, MIT)Yes: whole folders, driven by your AI coding agentProjects built with Claude Code, Cursor or Codex

Colour ramp recipes (hex codes)

These are the ramps from the slime illustration, free to reuse. Each has five steps in the same order (outline, shadow, base, light, highlight) with similar lightness at each step, so you can swap any of them for any other on a sprite drawn with the green ramp.

Green slime (original)

#1d3b2a #2f6b3e #4c9a5c #8fcf6a #d8f5a2

Shadows lean blue-green, highlights lean yellow: a classic natural ramp.

Fire slime (red → peach)

#3b1d24 #7a2e35 #c0453f #ef8a5c #ffd6a0

Hue slides from wine to orange to peach. Reads as "hotter, stronger" next to the green one: a natural tier-2 enemy.

Ice slime (navy → near-white)

#1b2340 #2f4f8c #4f86c9 #8fc4ec #e0f4ff

The light end is slightly desaturated toward white, which sells "frost". Keep the base step as light as the green base, or the slime looks smaller.

Poison slime (plum → pink)

#2a1838 #553070 #8a4fa8 #c58ad6 #f2d0f0

Purple's base looks darker than green at the same RGB brightness, so this ramp's light steps are pushed up to compensate.

How to build your own: keep the outline step dark (around the same lightness for every variant, so silhouettes match), keep the base step mid-value, and move hue 10–30° per step across the ramp. Check by viewing the variants in greyscale: if the greyscale versions look almost identical, the swap will read well. (A desaturate or greyscale adjustment on a copy, available in every editor above, makes this a five-second check.)

Common palette-swap mistakes

FAQ

How do I change every pixel of one colour at once in Aseprite?

Use Edit > Replace Color: choose the colour to find and the colour to put in its place, keep the tolerance at 0 for exact pixel art, and it applies to the active layer, frame or selection. For many colours at once, convert the sprite to indexed mode (Sprite > Color Mode > Indexed) and edit the palette entries instead: every pixel using that entry changes.

Should I bake palette swaps into PNG files or use a shader?

Bake them when you have a handful of fixed variants (enemy tiers, a few skins): it is simple, works in any engine and you can hand-tweak each one. Use a shader when the number of combinations is large or chosen at runtime (team colours, player customisation), because one sprite sheet plus small palette textures replaces dozens of sheets.

Why does my recolour leave stray pixels of the old colour?

Usually because the sprite contains near-duplicate colours: anti-aliasing, a soft brush, image resizing or lossy export (JPG, compressed textures) created shades that are almost, but not exactly, the colour you replaced. Rebuild the palette from the sprite, merge near-duplicates into the intended colour, and save as PNG before swapping.

Is shifting the hue of the whole sprite good enough?

It is a fast first draft, but a plain hue rotation keeps the RGB numbers' relationships, not the perceived lightness, so yellows look brighter and blues darker than the original and contrast changes. It also recolours parts that should stay fixed, such as eyes and outlines. Rebuilding each ramp with matching lightness gives cleaner variants.

How many colours should a ramp have for palette swapping?

Three to five colours per material is typical for small sprites: shadow, base and light, plus an optional dark outline tone and a highlight. Fewer colours per ramp means fewer colours to remap per variant and fewer chances of a mismatched step.

Can I make palette swaps for free without Aseprite?

Yes. LibreSprite and Pixelorama are free pixel-art editors, GIMP can edit an indexed image's colour map or use Colors > Map > Color Exchange, Krita can select by colour and refill or use its Gradient Map filter, and free browser tools such as Palette Swapper can generate many variants and export them as a ZIP of PNGs.

How do I recolour only part of a sprite, like armour but not skin?

Give each part its own ramp with colours that are not shared with any other part. If skin and armour share a colour, replacing it changes both. Reserve a "swappable" ramp for the team or skin colour and leave the other ramps untouched in every variant.

Why does my palette swap shader not match some pixels in Unity or Godot?

The texture is probably being filtered or compressed. Set the sprite to nearest/point filtering, disable compression (or use a lossless format), and avoid mipmaps, so the shader receives the exact colours it compares against or uses as indices.

Next steps

Start with one sprite and one extra ramp, check it in greyscale and in game, then scale up. If you want to skip the manual repeats, open Palette Swapper and export your first set of variants, or grab the free Slime Forge 16 palette to draw new sprites that are swap-ready from the start.