---
name: "SDL_SetPaletteColors"
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_SetPaletteColors"
---

# SDL\_SetPaletteColors(3)

Set a range of colors in a palette.

## NAME

SDL\_SetPaletteColors - Set a range of colors in a palette.

## HEADER FILE

Defined in SDL3/SDL\_pixels.h

## SYNOPSIS

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

**bool SDL\_SetPaletteColors(SDL\_Palette \*palette, const SDL\_Color \*colors, int firstcolor, int ncolors);**

## FUNCTION PARAMETERS

- *palette*

  the  **SDL\_Palette**\
    structure to modify.

- *colors*

  an array of  **SDL\_Color**\
    structures to copy into the palette.

- *firstcolor*

  the index of the first palette entry to modify.

- *ncolors*

  the number of entries to modify.

## RETURN VALUE

Returns true on success or false on failure; call

**SDL\_GetError** () for more information.

## THREAD SAFETY

It is safe to call this function from any thread, as long as the palette is not modified or destroyed in another thread.

## AVAILABILITY

This function is available since SDL 3.2.0.
