// gcc -lncurses curses.c #include<stdlib.h> #include<stdio.h> #include<curses.h> int main(int argc, char *argv[]) { initscr(); cbreak(); noecho(); clear(); curs_set(0); start_color(); erase(); mvprintw(5,5, "Press any key to exit"); int j = 30; for(int i = 1; i < COLORS; i++) { if (init_color(i, i, i, i) == ERR) mvprintw(j++, 0, "Error init_color %d", i); if (init_pair(i, i, COLOR_WHITE) == ERR) mvprintw(j++, 0, "Error init_pair %d", i); attron(COLOR_PAIR(i)); mvprintw(6 + i/16, i%16, "*"); attroff(COLOR_PAIR(i)); } refresh(); int ch = getch(); endwin(); return 0; }