---
name: "SDL_Palette"
section: "3"
platform: "linux"
package: "libsdl1.2-dev"
version: "1.2.15+dfsg2-8"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_Palette"
---

# SDL\_Palette(3)

Color palette for 8-bit pixel formats

## NAME

SDL\_Palette - Color palette for 8-bit pixel formats

## STRUCTURE DEFINITION

```
typedef struct{
  int ncolors;
  SDL_Color *colors;
} SDL_Palette;
```

## STRUCTURE DATA

- **ncolors**

  Number of colors used in this palette

- **colors**

  Pointer to **SDL\_Color** structures that make up the palette.

## DESCRIPTION

Each pixel in an 8-bit surface is an index into the **colors** field of the **SDL\_Palette** structure store in **SDL\_PixelFormat**. A **SDL\_Palette** should never need to be created manually. It is automatically created when SDL allocates a **SDL\_PixelFormat** for a surface. The colors values of a **SDL\_Surface**s palette can be set with the **SDL\_SetColors**.

## SEE ALSO

**SDL\_Color**, **SDL\_Surface**, **SDL\_SetColors** **SDL\_SetPalette**
