---
name: "SDL_CreatePalette"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_CreatePalette"
---

# SDL\_CreatePalette(3)

Create a palette structure with the specified number of color entries.

## NAME

SDL\_CreatePalette - Create a palette structure with the specified number of color entries.

## HEADER FILE

Defined in SDL3/SDL\_pixels.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**SDL\_Palette \* SDL\_CreatePalette(int ncolors);**

## DESCRIPTION

The palette entries are initialized to white.

## FUNCTION PARAMETERS

- *ncolors*

  represents the number of color entries in the color palette.

## RETURN VALUE

( **SDL\_Palette**\
  \*) Returns a new  **SDL\_Palette**

structure on success or NULL on failure (e.g. if there wasn't enough memory); call  **SDL\_GetError** () for more information.

## THREAD SAFETY

It is safe to call this function from any thread.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_DestroyPalette**(3)](/SDL_DestroyPalette/3.md), **•**(3), [**SDL\_SetPaletteColors**(3)](/SDL_SetPaletteColors/3.md), **•**(3), [**SDL\_SetSurfacePalette**(3)](/SDL_SetSurfacePalette/3.md)
