notcurses_palette(3)

πŸ’– NAME β€” notcurses_palette(3) πŸ’–

okay so bestie, this is the manual page for notcurses_palette, and it is literally all about operations on notcurses palettes. 🎨✨


✨ SYNOPSIS ✨

here’s the exact cast of characters, no cap, zero typos:

       #include <notcurses/notcurses.h>

              typedef struct ncpalette {
                // We store the RGB values as a regular ol' channel
                uint32_t chans[NCPALETTESIZE];
              } ncpalette;

       bool notcurses_cantruecolor(const struct notcurses* nc);

       ncpalette* ncpalette_new(struct notcurses* nc);

       int ncpalette_use(struct notcurses* nc, const ncpalette* p);

       int ncpalette_set_rgb8(ncpalette* p, int idx, int r, int g, int b);

       int ncpalette_set(ncpalette* p, int idx, unsigned rgb);

       int ncpalette_get(const ncpalette* p, int idx, uint32_t* palent);

       int ncpalette_get_rgb8(const ncpalette* p, int idx, int* restrict r,
       int* restrict g, int* restrict b);

       void ncpalette_free(ncpalette* p);

       bool notcurses_canchangecolors(const struct notcurses* nc);

πŸ¦‹ DESCRIPTION πŸ¦‹

some terminals are out here like β€œbestie I only do 256 colors,” but they still let you specify the full palette with arbitrary RGB colors. iconic behavior. πŸ’…

in all cases, though, it is more performant to use indexed colors, because that is much less data to write to the terminal. so if you can limit yourself to 256 colors, that’s probably for the best. fr fr. 🌸

plus, palette-based color allows for very fast color cycling effects, because a single command can affect many cells on the screen at once. the way that’s so main character energy. πŸŒˆπŸ‘‘


⭐ RETURN VALUES ⭐

  • functions returning int return -1 on failure, or 0 on success. failure is always due to invalid inputs. 🫢
  • functions returning bool are predicates, and they return the requested value. βœ…
  • functions returning unsigned forms return the input, modified as requested. πŸ”

πŸŽ€ SEE ALSO πŸŽ€


πŸ‘‘ AUTHORS πŸ‘‘

nick black β€” nickblack@linux.com πŸ’Œ


that’s the whole vibe, bestie. this lil page is from the notcurses_palette(3) manual and is rockin’ version v3.0.17. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from