bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reset color palette entry/entries to default?


From: Bill Gray
Subject: Reset color palette entry/entries to default?
Date: Fri, 30 Jul 2021 17:40:42 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

   ncurses provides,  as extensions,  free_pair() and
reset_color_pairs() to free up one or all color pairs.  I've
had a couple of situations where I'd like to do something
similar for palette entries.

   You _can_ simply read in the defaults and store them for later
use,  of course,  as in...

int default_r, default_g, default_b;

extended_color_content( palette_idx, &default_r, &default_g, &default_b);
init_extended_color( palette_idx, new_r, new_b, new_g);
/* do various stuff,  then return to original color : */
init_extended_color( palette_idx, default_r, default_g, default_b);

   with these being arrays if you're dealing with multiple palette
indices.  I am hoping that ncurses provides something such as

void reset_color( const int palette_idx);
void reset_all_colors( void);

   to set one or all colors back to their defaults.

   I am the maintainer for PDCursesMod,  and will probably add such
functions to that library.  My interest is partly in making sure
anything I do is compatible with ncurses,  if possible.

Thanks!           -- Bill



reply via email to

[Prev in Thread] Current Thread [Next in Thread]