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[256];
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_rgb8(const ncpalette* p, int idx, int* restrict r,
27 int* restrict g, int* restrict b);
28
29 void ncpalette_free(ncpalette* p);
30
31 bool notcurses_canchangecolors(const struct notcurses* nc);
32
34 Some terminals only support 256 colors, but allow the full palette to
35 be specified with arbitrary RGB colors. In all cases, it's more per‐
36 formant to use indexed colors, since it's much less data to write to
37 the terminal. If you can limit yourself to 256 colors, that's probably
38 for the best.
39
40 In addition, palette-based color allows for very fast color cycling ef‐
41 fects, since a single command can affect many cells on the screen.
42
44 Functions returning int return -1 on failure, or 0 on success. Failure
45 is always due to invalid inputs. Functions returning bool are predi‐
46 cates, and return the requested value. Functions returning unsigned
47 forms return the input, modified as requested.
48
50 notcurses(3), notcurses_cell(3), notcurses_channels(3), notcurses_out‐
51 put(3), notcurses_plane(3)
52
54 nick black <nickblack@linux.com>.
55
56
57
58 v2.4.9 notcurses_palette(3)