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.
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.
Two more ramp habits that pay off in variants:
- Hue shifting inside the ramp. Shadows drift toward a cooler or more saturated hue and highlights toward a warmer, lighter one (for example the fire ramp below goes from dark wine to peach). This keeps variants lively instead of looking like a tinted copy.
- Fixed colours stay fixed. Eyes, teeth, metal or a shared outline often look best unchanged across all variants. Keep them on colours that no swappable ramp uses.
Prepare your sprite before swapping
Ten minutes of cleanup here saves hours later, whichever tool you use.
- 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.
- Remove stray anti-aliasing shades. Near-duplicates (say
#4c9a5cand#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. - 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.
- 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.
- 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)
- Duplicate your file or layer so you keep the original (Sprite > Duplicate, or duplicate the layer).
- Open Edit > Replace Color (default shortcut Shift+R).
- Set From to the original colour and To to the new one. Keep Tolerance at 0 so only exact matches change.
- 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.
- Repeat for each colour of the ramp, darkest to lightest.
B. Indexed mode + palette edit (whole ramps at once)
- Convert with Sprite > Color Mode > Indexed. Each pixel now points to a palette entry.
- Unlock in-place palette editing with the padlock button above the colour bar.
- Double-click a palette entry (or use the colour picker) and change it: every pixel using that index updates on every frame instantly.
- Change the whole ramp, then save the palette (palette options menu) as a preset or a
.gplfile. Repeat with a new copy for each variant. - 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.
- Load or create your palette in the Palettes panel (it imports common formats such as
.gpl). - 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.
- 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)
- 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.
- Open the Colormap dialog (Windows > Dockable Dialogs > Colormap).
- Double-click a colour entry and type the new hex value. All pixels using that entry change.
- Export with File > Export As… to PNG, then repeat on a copy for the next variant.
B. Color Exchange or Rotate Colors (RGB images)
- Colors > Map > Color Exchange swaps one source colour for one target colour; keep thresholds at 0 for pixel art.
- 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.
- 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).
- Fill the selection with the new colour (Shift+Backspace fills with the foreground colour), then deselect and repeat.
- 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.
- 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.
- 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.
- Open Palette Swapper and drop your PNG files.
- Click + Variant (or + Hue-shifted variant) and set the new colours ramp by ramp.
- Check the preview at 1x and zoomed in; save the project if you want to come back to it.
- Click Download all variants (.zip) and Export palettes.
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 versionOther 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?
| Tool | Price | Many variants / batch | Best for |
|---|---|---|---|
| Aseprite | Paid, one-time (or compile the source yourself) | Manual per variant; batch via Lua scripts or extensions | Daily pixel-art work, animated sprites, indexed palette edits |
| LibreSprite | Free, open source | Manual | An Aseprite-style workflow on zero budget |
| Pixelorama | Free, open source | Manual; Palettize effect for whole-palette snapping | Free editor on desktop or in the browser |
| GIMP | Free, open source | Manual; scriptable with plug-ins | Exact colour-map edits in indexed mode |
| Krita | Free, open source | Manual; reusable filter masks | Painters; Gradient Map recolours that follow lightness |
| Godot / Unity shader | Free (engine) | Unlimited at runtime from palette textures | Team colours, player customisation, many combinations |
| Palette Swapper | Free | Yes: many sprites × many variants, one ZIP + .gpl/.hex | Baking a set of variants quickly without installing anything |
| Palette Swapper MCP | 4 € (Lite: free, MIT) | Yes: whole folders, driven by your AI coding agent | Projects 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)
Shadows lean blue-green, highlights lean yellow: a classic natural ramp.
Fire slime (red → peach)
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)
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)
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
- Swapping hue only. A raw hue rotation turns your mid-green into a much brighter yellow or a much darker blue. Contrast breaks and some details disappear. Fix values ramp by ramp.
- Shared colours between materials. The skin turns red with the armour. Give every swappable part its own ramp.
- Hidden near-duplicate colours. Replace Color "misses" pixels that are one RGB unit off. Rebuild the palette from the sprite first.
- Swapping the outline with the body. A coloured outline that follows each variant can look great, but a black or dark shared outline keeps silhouettes consistent. Decide once and apply it everywhere.
- Variants that only differ by colour. Colour-blind players may not tell red and green apart. For gameplay-relevant differences (stronger enemy, other team), also change value or add a small shape cue such as a horn or a hat.
- Forgetting the background. A dark-blue ice slime on a night level vanishes. Test each variant on the real backgrounds.
- Lossy files or filtered textures. JPG export, texture compression or bilinear filtering create new in-between colours that no mapping or shader will catch.
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.