.\" Automatically generated by Pandoc 2.17.1.1 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. .ie "\f[CB]x\f[]"x" \{\ . ftr V B . ftr VI BI . ftr VB B . ftr VBI BI .\} .el \{\ . ftr V CR . ftr VI CI . ftr VB CB . ftr VBI CBI .\} .TH "notcurses_palette" "3" "v3.0.7" "" "" .hy .SH NAME .PP notcurses_palette - operations on notcurses palettes .SH SYNOPSIS .PP \f[B]#include \f[R] .IP .nf \f[C] typedef struct ncpalette { // We store the RGB values as a regular ol\[aq] channel uint32_t chans[NCPALETTESIZE]; } ncpalette; \f[R] .fi .PP \f[B]bool notcurses_cantruecolor(const struct notcurses* \f[R]\f[I]nc\f[R]\f[B]);\f[R] .PP \f[B]ncpalette* ncpalette_new(struct notcurses* \f[R]\f[I]nc\f[R]\f[B]);\f[R] .PP \f[B]int ncpalette_use(struct notcurses* \f[R]\f[I]nc\f[R]\f[B], const ncpalette* \f[R]\f[I]p\f[R]\f[B]);\f[R] .PP \f[B]int ncpalette_set_rgb8(ncpalette* \f[R]\f[I]p\f[R]\f[B], int \f[R]\f[I]idx\f[R]\f[B], int \f[R]\f[I]r\f[R]\f[B], int \f[R]\f[I]g\f[R]\f[B], int \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]int ncpalette_set(ncpalette* \f[R]\f[I]p\f[R]\f[B], int \f[R]\f[I]idx\f[R]\f[B], unsigned \f[R]\f[I]rgb\f[R]\f[B]);\f[R] .PP \f[B]int ncpalette_get(const ncpalette* \f[R]\f[I]p\f[R]\f[B], int \f[R]\f[I]idx\f[R]\f[B], uint32_t* \f[R]\f[I]palent\f[R]\f[B]);\f[R] .PP \f[B]int ncpalette_get_rgb8(const ncpalette* \f[R]\f[I]p\f[R]\f[B], int \f[R]\f[I]idx\f[R]\f[B], int* restrict \f[R]\f[I]r\f[R]\f[B], int* restrict \f[R]\f[I]g\f[R]\f[B], int* restrict \f[R]\f[I]b\f[R]\f[B]);\f[R] .PP \f[B]void ncpalette_free(ncpalette* \f[R]\f[I]p\f[R]\f[B]);\f[R] .PP \f[B]bool notcurses_canchangecolors(const struct notcurses* \f[R]\f[I]nc\f[R]\f[B]);\f[R] .SH DESCRIPTION .PP Some terminals only support 256 colors, but allow the full palette to be specified with arbitrary RGB colors. In all cases, it\[aq]s more performant to use indexed colors, since it\[aq]s much less data to write to the terminal. If you can limit yourself to 256 colors, that\[aq]s probably for the best. .PP In addition, palette-based color allows for very fast color cycling effects, since a single command can affect many cells on the screen. .SH RETURN VALUES .PP Functions returning \f[B]int\f[R] return -1 on failure, or 0 on success. Failure is always due to invalid inputs. Functions returning \f[B]bool\f[R] are predicates, and return the requested value. Functions returning \f[B]unsigned\f[R] forms return the input, modified as requested. .SH SEE ALSO .PP \f[B]notcurses(3)\f[R], \f[B]notcurses_cell(3)\f[R], \f[B]notcurses_channels(3)\f[R], \f[B]notcurses_output(3)\f[R], \f[B]notcurses_plane(3)\f[R] .SH AUTHORS nick black .