vex.c
/* Let ncurses take over the terminal and initialize colors. */
Let ncurses take over the terminal and initialize colors.
Let ncurses take over the terminal and initialize colors .
void ncurses_init(bool use_colors)
{
    initscr();
    noecho();
    raw();
    keypad(stdscr, true);
    if (!use_colors) return;
    if (has_colors()) {
        start_color();
        use_default_colors();
        init_pair(WHITE, COLOR_WHITE, -1);
        init_pair(BLACK, -1, COLOR_BLACK);
        init_pair(RED, COLOR_RED, -1);
        init_pair(GREEN, COLOR_GREEN, -1);
        init_pair(BLUE, COLOR_BLUE, -1);
        init_pair(CYAN, COLOR_CYAN, -1);
        init_pair(YELLOW, COLOR_YELLOW, -1);
        init_pair(MAGENTA, COLOR_MAGENTA, -1);
        init_pair(ORANGE, COLOR_YELLOW, -1);
    } else {
        endwin();
        fprintf(stderr, "Error your terminal does not support colors.\n");
        exit(1);
    }
}
void ncurses_init ( bool use_colors ) { initscr ( ) ; noecho ( ) ; raw ( ) ; keypad ( stdscr , true ) ; if ( ! use_colors ) return ; if ( has_colors ( ) ) { start_color ( ) ; use_default_colors ( ) ; init_pair ( WHITE , COLOR_WHITE , -1 ) ; init_pair ( BLACK , -1 , COLOR_BLACK ) ; init_pair ( RED , COLOR_RED , -1 ) ; init_pair ( GREEN , COLOR_GREEN , -1 ) ; init_pair ( BLUE , COLOR_BLUE , -1 ) ; init_pair ( CYAN , COLOR_CYAN , -1 ) ; init_pair ( YELLOW , COLOR_YELLOW , -1 ) ; init_pair ( MAGENTA , COLOR_MAGENTA , -1 ) ; init_pair ( ORANGE , COLOR_YELLOW , -1 ) ; } else { endwin ( ) ; fprintf ( stderr , " \n " ) ; exit ( 1 ) ; } }
Let ncurses take over the terminal and initialize colors.
Let ncurses take over the terminal and initialize colors .
// I have a lot of libs to work with colors. // And I am not using them. // No colors, not fun!