2020-01-15 11:14:08 +00:00
|
|
|
% notcurses_palette(3)
|
|
|
|
% nick black <nickblack@linux.com>
|
2021-11-19 02:36:24 +00:00
|
|
|
% v2.4.97
|
2020-01-15 11:14:08 +00:00
|
|
|
|
|
|
|
# NAME
|
|
|
|
|
|
|
|
notcurses_palette - operations on notcurses palettes
|
|
|
|
|
|
|
|
# SYNOPSIS
|
|
|
|
|
2020-04-19 22:46:32 +00:00
|
|
|
**#include <notcurses/notcurses.h>**
|
2020-01-15 11:14:08 +00:00
|
|
|
|
|
|
|
```c
|
2021-04-22 08:11:06 +00:00
|
|
|
typedef struct ncpalette {
|
2020-01-15 11:14:08 +00:00
|
|
|
// We store the RGB values as a regular ol' channel
|
|
|
|
uint32_t chans[256];
|
2021-04-22 08:11:06 +00:00
|
|
|
} ncpalette;
|
2020-01-15 11:14:08 +00:00
|
|
|
```
|
|
|
|
|
2020-11-06 21:49:35 +00:00
|
|
|
**bool notcurses_cantruecolor(const struct notcurses* ***nc***);**
|
2020-06-18 15:04:29 +00:00
|
|
|
|
2021-04-22 08:11:06 +00:00
|
|
|
**ncpalette* ncpalette_new(struct notcurses* ***nc***);**
|
2020-01-15 11:14:08 +00:00
|
|
|
|
2021-04-22 08:11:06 +00:00
|
|
|
**int ncpalette_use(struct notcurses* ***nc***, const ncpalette* ***p***);**
|
2020-01-15 11:14:08 +00:00
|
|
|
|
2021-04-22 08:11:06 +00:00
|
|
|
**int ncpalette_set_rgb8(ncpalette* ***p***, int ***idx***, int ***r***, int ***g***, int ***b***);**
|
2020-01-15 11:14:08 +00:00
|
|
|
|
2021-04-22 08:11:06 +00:00
|
|
|
**int ncpalette_set(ncpalette* ***p***, int ***idx***, unsigned ***rgb***);**
|
2020-01-15 11:14:08 +00:00
|
|
|
|
2021-04-22 08:11:06 +00:00
|
|
|
**int ncpalette_get_rgb8(const ncpalette* ***p***, int ***idx***, int* restrict ***r***, int* restrict ***g***, int* restrict ***b***);**
|
2020-01-15 11:14:08 +00:00
|
|
|
|
2021-04-22 08:11:06 +00:00
|
|
|
**void ncpalette_free(ncpalette* ***p***);**
|
2020-01-15 11:14:08 +00:00
|
|
|
|
2020-11-06 21:49:35 +00:00
|
|
|
**bool notcurses_canchangecolors(const struct notcurses* ***nc***);**
|
2020-01-19 11:16:09 +00:00
|
|
|
|
2020-01-15 11:14:08 +00:00
|
|
|
# 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
|
|
|
|
|
2021-04-22 08:11:06 +00:00
|
|
|
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
|
2020-01-15 11:14:08 +00:00
|
|
|
input, modified as requested.
|
|
|
|
|
|
|
|
# SEE ALSO
|
|
|
|
|
2020-05-09 00:56:39 +00:00
|
|
|
**notcurses(3)**,
|
2020-12-16 10:40:14 +00:00
|
|
|
**notcurses_cell(3)**,
|
2020-05-09 00:56:39 +00:00
|
|
|
**notcurses_channels(3)**,
|
|
|
|
**notcurses_output(3)**,
|
|
|
|
**notcurses_plane(3)**
|