---
name: "notcurses_palette"
section: "3"
platform: "linux"
package: "notcurses"
version: "3.0.17-3"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/notcurses_palette"
---

# notcurses\_palette(3)

operations on notcurses palettes

## NAME

notcurses\_palette - operations on notcurses palettes

## SYNOPSIS

**#include \<notcurses/notcurses.h\>**

-

  ```
  typedef struct ncpalette {
    // We store the RGB values as a regular ol' channel
    uint32_t chans[NCPALETTESIZE];
  } ncpalette;
  ```

**bool notcurses\_cantruecolor(const struct notcurses\*** *nc***);**

**ncpalette\* ncpalette\_new(struct notcurses\*** *nc***);**

**int ncpalette\_use(struct notcurses\*** *nc***, const** **ncpalette\*** *p***);**

**int ncpalette\_set\_rgb8(ncpalette\*** *p***, int** *idx***, int** *r***, int** *g***, int** *b***);**

**int ncpalette\_set(ncpalette\*** *p***, int** *idx***, unsigned** *rgb***);**

**int ncpalette\_get(const ncpalette\*** *p***, int** *idx***, uint32\_t\*** *palent***);**

**int ncpalette\_get\_rgb8(const ncpalette\*** *p***, int** *idx***, int\* restrict** *r***, int\*** **restrict** *g***, int\* restrict** *b***);**

**void ncpalette\_free(ncpalette\*** *p***);**

**bool notcurses\_canchangecolors(const struct notcurses\*** *nc***);**

## DESCRIPTION

Some terminals only support 256 colors, but allow the full palette to be specified with arbitrary RGB colors. In all cases, it's more performant to use indexed colors, since it's much less data to write to the terminal. If you can limit yourself to 256 colors, that's probably for the best.

In addition, palette-based color allows for very fast color cycling effects, since a single command can affect many cells on the screen.

## RETURN VALUES

Functions returning **int** return -1 on failure, or 0 on success. Failure is always due to invalid inputs. Functions returning **bool** are predicates, and return the requested value. Functions returning **unsigned** forms return the input, modified as requested.

## SEE ALSO

**[notcurses(3)](/notcurses/3.md)**, **[notcurses\_cell(3)](/notcurses_cell/3.md)**, **[notcurses\_channels(3)](/notcurses_channels/3.md)**, **[notcurses\_output(3)](/notcurses_output/3.md)**, **[notcurses\_plane(3)](/notcurses_plane/3.md)**

## AUTHORS

nick black ⟨nickblack@linux.com⟩\\c.
