1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 04:17:33 +00:00

ncurses: call init_pair immediately before using colors

this allows using color0, etc. in ncurses; the nearest available ncurses color will be used
This commit is contained in:
bi4k8 2023-02-05 02:56:13 +00:00 committed by Brenden Matthews
parent 9cc4b083fc
commit d51bf688ba
2 changed files with 1 additions and 1 deletions

View File

@ -761,7 +761,6 @@ struct text_object *construct_text_object(char *s, const char *arg, long line,
Colour c = arg != nullptr ? parse_color(arg) : default_color.get(*state); Colour c = arg != nullptr ? parse_color(arg) : default_color.get(*state);
obj->data.l = c.to_argb32(); obj->data.l = c.to_argb32();
set_current_text_color(c); set_current_text_color(c);
init_pair(c.to_ncurses(), c.to_ncurses(), COLOR_BLACK);
} }
#endif /* BUILD_NCURSES */ #endif /* BUILD_NCURSES */
obj->callbacks.print = &new_fg; obj->callbacks.print = &new_fg;

View File

@ -81,6 +81,7 @@ bool display_output_ncurses::initialize() {
bool display_output_ncurses::shutdown() { return false; } bool display_output_ncurses::shutdown() { return false; }
void display_output_ncurses::set_foreground_color(Colour c) { void display_output_ncurses::set_foreground_color(Colour c) {
init_pair(c.to_ncurses(), c.to_ncurses(), COLOR_BLACK);
attron(COLOR_PAIR(c.to_ncurses())); attron(COLOR_PAIR(c.to_ncurses()));
} }