Building a Color Palette for Pixel Art Robots
Color is the fastest way to ruin procedurally generated art. Give a random generator access to the full RGB spectrum and you’ll get garish, clashing combinations that look like they were designed by a malfunctioning traffic light. But constrain the color system intelligently and every random output looks intentional, cohesive, and polished.
This is the central tension in procedural art: you want variety without chaos. For pixel art specifically – where you’re working with a tiny number of visible pixels – color choices carry even more weight than in higher-resolution work. Every pixel matters, and every color relationship is visible.
Here’s how to build a color palette system that makes pixel art robots look good every time.
The 5-Role Palette Model
Rather than picking colors individually, effective pixel art palettes assign colors to roles. In MechGen’s system, each palette defines exactly 5 values:
- Primary: The dominant body color. This covers the largest surface area – the torso, head base, and leg structures. It’s what you “see” when you glance at the mech.
- Secondary: Detail and accent structure color. Used for arm segments, body panels, and structural details that break up the primary mass.
- Accent: High-contrast highlight color. Applied sparingly to draw attention – antenna tips, chest lights, energy cores, and joint highlights.
- Eyes: The eye/visor color. Often the most saturated or brightest value in the palette because eyes are the focal point of any character, even a robot.
- Background: The color behind the mech. This isn’t just “fill” – it establishes the contrast relationship with the entire figure.
This role-based approach means you can swap palettes freely and the mech’s visual hierarchy stays intact. A cyberpunk teal-and-magenta palette and a military olive-and-khaki palette will both produce readable mechs because the roles ensure the right colors end up in the right places.
Why 5 Roles, Not More?
Pixel art has a long tradition of limited palettes. The NES used 4 colors per sprite. The Game Boy had 4 shades of green. Early CGA graphics had 4 colors total. These constraints weren’t just technical limitations – they forced artists to make every color count.
With 5 base colors, you have enough range for a primary/secondary/accent hierarchy while keeping the total count low enough that the palette reads as unified. Add more roles and you start getting muddy compositions where no single color dominates. Fewer roles and you lose the ability to separate structural elements from detail elements.
Five is the sweet spot for character sprites at the 64x64 scale.
Algorithmic Shading: Depth from a Single Hex Value
Here’s where the system gets interesting. MechGen doesn’t actually use just 5 flat colors. It generates shading variations algorithmically using darken() and lighten() helper functions. Given a single hex color, these functions produce shadow and highlight versions by adjusting the RGB channels:
// Simplified concept
function darken(hex, amount) {
// Parse hex to RGB, reduce each channel, return new hex
const r = Math.max(0, parseInt(hex.slice(1,3), 16) - amount);
const g = Math.max(0, parseInt(hex.slice(3,5), 16) - amount);
const b = Math.max(0, parseInt(hex.slice(5,7), 16) - amount);
return `#${r.toString(16).padStart(2,'0')}${g.toString(16).padStart(2,'0')}${b.toString(16).padStart(2,'0')}`;
}
This means every base color automatically has a shadow and highlight variant. The mech’s body gets a darker underside and lighter top edge. Arm segments get shadow on one side. Legs show depth where they overlap the body. All from a single hex per role.
The shading approach has a critical advantage for procedural systems: it’s automatic. You don’t need to hand-pick shadow colors for each palette. Define 5 base colors, and the darken/lighten functions derive a full shading ramp that’s always harmonious with the base.
A Key Constraint
The darken() and lighten() functions only work with hex color strings – not named CSS colors or rgb() values. This is a deliberate design choice. Hex strings are easy to parse component-wise, and standardizing on one format avoids edge cases. The one exception is the transparent background, which bypasses shading entirely since there’s no color to shade.
What Makes a Good Pixel Art Palette
Whether you’re building palettes for MechGen or your own pixel art project, these principles consistently produce strong results:
Controlled Saturation Range
Limit how saturated your palette gets. One or two highly saturated colors (eyes, accent) create focal points. Primary and secondary colors should be more muted. If everything is vivid, nothing stands out.
Value Separation
The most important property of a palette isn’t hue – it’s value (lightness/darkness). Colors that are different hues but similar values will blend together at small sizes. Your primary and secondary colors need enough value contrast that they’re distinguishable at 32px display size.
Test this by converting your palette to grayscale. If two roles become indistinguishable in grayscale, they need more value separation.
Temperature Consistency
Most strong palettes lean either warm or cool rather than mixing wildly. A warm palette (reds, oranges, ambers) with one cool accent (teal eyes) reads as intentional. A palette that bounces between warm and cool without a clear dominant temperature feels random.
MechGen’s cyberpunk-themed palettes tend toward cool dominance (teals, blues, purples) with warm accents (orange, magenta, amber) – a classic combination in sci-fi visual design.
Background Contrast
The background color defines the overall contrast of the piece. Dark backgrounds make the mech pop and work well on platforms with dark themes (Discord, Steam). Light backgrounds feel more approachable and work in documentation, wikis, or light-themed UIs.
For transparent backgrounds, think about where the avatar will appear. On a dark Discord sidebar, a mech with dark colors will disappear. On a white GitHub profile, a very light mech will wash out.
MechGen’s 12 Curated Palettes
MechGen ships with 12 palettes, each tested across the full range of part combinations to ensure readability. They span a range of moods and themes:
- Deep cyans and electric blues for a classic cyberpunk feel
- Military olives, khakis, and rust for a rugged, industrial aesthetic
- Hot pinks and magentas for high-energy, synthwave-inspired designs
- Grayscale and muted tones for clean, minimal mechs
- Warm ambers and reds for aggressive, fiery robots
Each palette was built by selecting base colors, testing them through the darken/lighten shading system, and verifying that all 7 part categories remain visually distinct at 64x64 resolution.
When you hit “Randomize” in the generator, the palette selection is part of the randomization. This is why every random mech looks cohesive – the palette system guarantees color harmony regardless of which parts are selected.
Building Your Own Palette
If you want to create custom palettes in MechGen, use the color picker controls to set each of the 5 roles. Here’s a workflow:
- Start with primary. Pick the dominant mood. This single color sets the character’s identity.
- Choose secondary. Pick a color 2-3 value steps away from primary, either warmer or cooler. This creates structural contrast.
- Set the accent. Go bold. This should be the most distinct color – it draws the eye and breaks up large areas.
- Pick eye color. High saturation or high brightness. The eyes are the focal point.
- Set background. Test both a dark and light option. Choose based on where you’ll use the avatar.
Then hit randomize a few times (keeping your palette) to see how the colors work across different part combinations. If any combination looks bad, adjust the problem role.
Constraints Create Character
The lesson from MechGen’s palette system applies broadly to pixel art: limitation is a feature, not a bug. Five roles, algorithmic shading, and curated palettes produce better results than unlimited color freedom because they ensure every output respects the same visual rules. When you design within constraints, the randomness becomes creative variety instead of visual noise.
Try experimenting with palettes in the MechGen generator – swap between the 12 built-in options or build your own using the color pickers. See how the same mech transforms when you change nothing but the five colors that define it.