1notcurses_palette(3) notcurses_palette(3)
2
3
4
6 notcurses_palette - operations on notcurses palettes
7
9 #include <notcurses/notcurses.h>
10
11 typedef struct ncpalette {
12 // We store the RGB values as a regular ol' channel
13 uint32_t chans[NCPALETTESIZE];
14 } ncpalette;
15
16 bool notcurses_cantruecolor(const struct notcurses* nc);
17
18 ncpalette* ncpalette_new(struct notcurses* nc);
19
20 int ncpalette_use(struct notcurses* nc, const ncpalette* p);
21
22 int ncpalette_set_rgb8(ncpalette* p, int idx, int r, int g, int b);
23
24 int ncpalette_set(ncpalette* p, int idx, unsigned rgb);
25
26 int ncpalette_get(const ncpalette* p, int idx, uint32_t* palent);
27
28 int ncpalette_get_rgb8(const ncpalette* p, int idx, int* restrict r,
29 int* restrict g, int* restrict b);
30
31 void ncpalette_free(ncpalette* p);
32
33 bool notcurses_canchangecolors(const struct notcurses* nc);
34
36 Some terminals only support 256 colors, but allow the full palette to
37 be specified with arbitrary RGB colors. In all cases, it's more per‐
38 formant to use indexed colors, since it's much less data to write to
39 the terminal. If you can limit yourself to 256 colors, that's probably
40 for the best.
41
42 In addition, palette-based color allows for very fast color cycling ef‐
43 fects, since a single command can affect many cells on the screen.
44
46 Functions returning int return -1 on failure, or 0 on success. Failure
47 is always due to invalid inputs. Functions returning bool are predi‐
48 cates, and return the requested value. Functions returning unsigned
49 forms return the input, modified as requested.
50
52 notcurses(3), notcurses_cell(3), notcurses_channels(3), notcurses_out‐
53 put(3), notcurses_plane(3)
54
56 nick black <nickblack@linux.com>.
57
58
59
60 v3.0.8 notcurses_palette(3)