Skip to Content

How do nes colors work?


The Nintendo Entertainment System (NES) was a revolutionary console when it was released in 1983. With its 8-bit graphics and sound capabilities, the NES could display games with more complex visuals and audio than previous home consoles. One of the keys to the NES’s improved graphics was its use of a dedicated picture processing unit (PPU) chip. This allowed the NES to generate a diverse palette of colors and detailed pixel graphics. In this article, we’ll take a deep dive into how the NES PPU chip generated colors and the limitations and quirks of the NES color palette.

The NES Picture Processing Unit

The NES’s Ricoh-designed PPU was a specialized microprocessor devoted to generating video output. It worked in conjunction with the main 6502 CPU to construct the game’s graphics and send them to the user’s TV screen.

Some key capabilities of the NES PPU include:

  • Support for displaying sprites – movable pixel-based objects like characters and power-ups.
  • Tile-based backgrounds constructed from 8×8 pixel tiles.
  • A total screen resolution of 256×240 pixels.
  • A color palette of 48 colors, with up to 25 displayed onscreen at once.

The PPU contained video RAM (VRAM) that stored graphics data like sprite patterns and background tiles. By cleverly arranging this video data and cycling through palettes, the PPU could generate detailed and colorful graphics within the limitations of 1980s technology.

NES Color Palette

The NES color palette is one of the console’s most iconic attributes. The NES could generate a total of 48 different colors. Only 25 of these could be displayed on any single TV frame.

The colors were chosen to provide flexibility while minimizing visual artifacts on 1980s TV screens. Here is the complete 48 color NES palette:

#7C7C7C #0000FC #0000BC #4428BC
#940084 #A80020 #A81000 #881400
#503000 #007800 #006800 #005800
#004058 #000000 #000000 #000000
#BCBCBC #0078F8 #0058F8 #6844FC
#D800CC #E40058 #F83800 #E45C10
#AC7C00 #00B800 #00A800 #00A844
#008888 #000000 #000000 #000000
#FFFFFF #FFFFFF #FFFFFF #FFFFFF
#000000 #000000 #000000 #000000

As you can see, the NES color palette consists mostly of darker, subdued tones. This was to minimize color bleeding and banding effects on 1980s televisions and RF connectors. Still, skilled NES programmers were able to use the flexible palettes to generate appealing graphics.

NES Color Limitations

Despite its innovations, the NES was still limited to 8-bit color graphics. There were several constraints on NES colors:

  • Only 25 colors could be displayed onscreen at once from the 48 color master palette.
  • Sprite palettes were even more restricted. 8×8 pixel NES sprites could only use 4 colors.
  • Color attributes were assigned per tile or sprite. This meant adjacent tiles/sprites couldn’t blend colors smoothly.
  • The PPU could only read one palette at a time. This could result in attribute clash if poorly managed.

Programmers had to carefully manage NES color limitations. But techniques like dithering and palace cycling helped them make the most of the capabilities.

NES Palette Selection

So how did NES games choose those onscreen colors from the master 48 color palette?

The NES PPU used location in memory to determine sprite and background colors. By changing the location of video data in VRAM, the game could effectively change the palette.

Memory location Palette colors
$0000-$0FFF Palette 0
$1000-$1FFF Palette 1
$2000-$2FFF Palette 2
$3000-$3FFF Palette 3

For example, data in address range $1000-$1FFF would use palette 1’s colors. Addresses $3000-$3FFF would use palette 3.

This gave games 256 different palette options for color variety!

NES Background Colors

NES background colors were defined by the palettes assigned to each tile:

  • Backgrounds were constructed from 8×8 pixel tiles.
  • Each 8×8 tile could be assigned one of the 4 available palettes.
  • By assigning different palettes to adjacent tiles, the background could display up to 25 colors.

Careful tile arrangement allowed backgrounds to contain multiple palettes. But the attribute clash problem could cause issues:

Attribute clash happened when adjacent tiles had differing palettes. Clever programming tactics like nametables and mirroring helped work around this.

NES Sprite Colors

NES sprites used a similar palette system, but had more color limitations:

  • Sprites were the moving elements like characters and power-ups.
  • Each 8×8 sprite could only be assigned one of the 4 available palettes.
  • But unlike backgrounds, those sprites were restricted to the same 4 colors across the entire palette.

So an 8×8 sprite using palette 0 could only use colors 0-3 of that palette. This was a strict limitation compared to backgrounds.

Programmers used techniques like sprite stacking and palette swapping to work around the limits. But it took effort and creativity!

Popular NES Color Palettes

Many classic NES games creatively used color palettes to generate distinctive visual styles:

Game Description
Super Mario Bros. Used warm palette 0 colors for ground, cool palette 1 for underground levels.
Mega Man Assigned a unique palette for each robot master stage.
Castlevania Dramatic gothic palette to match horror theme.
Bubble Bobble Pastel palette matched cute characters and theme.

NES artists learned to work magic within the color limitations. Their expertise turned constraints into iconic graphic design.

Advanced NES Color Techniques

As developers mastered the system, they discovered advanced color techniques that further pushed the limits:

  • Dithering: Blending pixels to simulate colors between palette values.
  • Cycling: Rapidly swapping palettes to animate colors.
  • Fading: Gradually increasing color intensity for effects like flashing.
  • Error diffusion: Strategic palette choice to minimize attribute clash.

These innovations enabled vivid fire and water effects, transparency, shadows, and more on the humble NES hardware!

Color Limitations in NES Games

The strict NES color system meant programmers had to be creative to work around limitations. Some notable examples include:

  • Only having blue water because the transparent blue value was reused for other sprites.
  • Flickering sprite artifacts when too many appeared on screen.
  • Visibility issues with sprites blending into similarly colored backgrounds.
  • Restricted color variety in early games before advanced techniques were discovered.

Despite its quirks, the NES color palette become a beloved part of the system’s identity. Game developers learned to embrace the constraints and use colors strategically to maximum effect. The limitations even contributed to many games’ iconic 8-bit graphical styles.

Conclusion

The NES color palette is a testament to the artistry and creativity possible even under tight technical constraints. While limited to 8-bit, 48 color graphics, the talents of NES pixel artists and programmers made the most of the capabilities. Their groundbreaking efforts expanded the artistic potential of early video game visuals.

Today, the NES palette remains an inspiration for modern indie developers. Its retro style is frequently used in new games seeking to evoke gaming’s early eras. The striking colors are a signature of both the NES platform and an innovative time in the growth of the medium. Both the capabilities and limitations of the NES color palette left an indelible mark on gaming history.