I'm working with ncurses on Linux, I have created two windows (winReception and winTransmission) basically winTransmission is for writing stuff to print in winReception. So, I'd like to print the text in winReception in certain color but it's not working it prints normally, no colors.
Any thoughts on why it's not working? I tried changing the colors of the window instead but it changes the color of all the text in the window, which is not what I want.
Edit: Forgot to mention that winTransmission do not need to change colors. Only winReception needs to change colors.
Here is the code you need to understand what I'm doing:
initscr();
/* WINDOW RECEPTION */
winReception = newwin(27, 0, 0, 0);
/* WINDOW TRANSMISSION */
winTransmission = newwin(8, 0, 27, 0);
if (!has_colors()) {
endwin();
fprintf(stderr, "Error - no color support on this terminal\n");
exit(1);
}
if (start_color() != OK) {
endwin();
fprintf(stderr, "Error - could not initialize colors\n");
exit(2);
}
init_pair(1, COLOR_RED, COLOR_BLACK);
init_pair(2, COLOR_RED, COLOR_GREEN);
attrset(COLOR_PAIR(1));
/* WINDOW RECEPTION */
mvwprintw(winReception, 1, 2, "%s", textinwindow);
wrefresh(winReception);
/* WINDOW TRANSMISSION */
touchwin(winTransmission);
wclear(winTransmission);
wrefresh(winTransmission);