---
name: "ggiSetPalette"
section: "3"
platform: "linux"
package: "libggi2-dev"
version: "1:2.2.2-5"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/ggiSetPalette"
---

# ggiSetPalette(3)

Manipulate the palette of a visual

## NAME

**ggiSetPalette**, **ggiGetPalette** - Manipulate the palette of a visual

## SYNOPSIS

```
#include <ggi/ggi.h>
int ggiSetPalette(ggi_visual_t vis, int s, int len, const ggi_color *cmap);
int ggiGetPalette(ggi_visual_t vis, int s, int len, ggi_color *cmap);
```

## DESCRIPTION

LibGGI visuals in **GT\_PALETTE** mode map all pixelvalues to the corresponding **[ggi\_color(3)](/ggi_color/3.md)** entry in the visual's palette.

**ggiSetPalette** sets a range of palette values of length *len*, starting at index number *s*.  The index can be **GGI\_PALETTE\_DONTCARE** to indicate that the palette can be installed anywhere in the CLUT.  This allows optimized use in windowing environments (to minimize color flashing between windows) and should be used if possible.

**ggiGetPalette** copies the specified colors (starting from *s*, for *len* colors) from the visual's palette to the array pointed by *cmap*.

## RETURN VALUE

**ggiSetPalette** returns the number of the first entry changed. **\<0** indicate a `ggi-error(3)`.

**ggiGetPalette** returns **0** for OK, otherwise a `ggi-error(3)` code. When called with len=0 this function will not automatically succeed, but the return code will indicate whether there is a readable CLUT.

## PALETTE IN GGI

Write something useful here.

## SEE ALSO

`ggiSetColorfulPalette(3)`
