.\" Automatically generated by Pandoc 2.9.2.1 .\" .TH "notcurses_palette" "3" "v2.0.4" "" "" .hy .SH NAME .PP notcurses_palette - operations on notcurses palettes .SH SYNOPSIS .PP \f[B]#include \f[R] .IP .nf \f[C] typedef struct palette256 { // We store the RGB values as a regular ol\[aq] channel uint32_t chans[256]; } palette256; \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]palette256* palette256_new(struct notcurses* \f[R]\f[I]nc\f[R]\f[B]);\f[R] .PP \f[B]int palette256_use(struct notcurses* \f[R]\f[I]nc\f[R]\f[B], const palette256* \f[R]\f[I]p\f[R]\f[B]);\f[R] .PP \f[B]int palette256_set_rgb8(palette256* \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 palette256_set(palette256* \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 palette256_get_rgb8(const palette256* \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 palette256_free(palette256* \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\[cq]s more performant to use indexed colors, since it\[cq]s much less data to write to the terminal. If you can limit yourself to 256 colors, that\[cq]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[C]int\f[R] return -1 on failure, or 0 on success. Failure is always due to invalid inputs. Functions returning \f[C]bool\f[R] are predicates, and return the requested value. Functions returning \f[C]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 .