X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fbackground.c;fp=test%2Fbackground.c;h=7b1d22746c7281aa3fe71903c0ebcb46e71a48d1;hp=0000000000000000000000000000000000000000;hb=a8987e73ec254703634802b4f7ee30d3a485524d;hpb=46722468f47c2b77b3987729b4bcf2321cccfd01 diff --git a/test/background.c b/test/background.c new file mode 100644 index 00000000..7b1d2274 --- /dev/null +++ b/test/background.c @@ -0,0 +1,68 @@ +/* + * $Id: background.c,v 1.1 2003/12/07 00:06:33 tom Exp $ + */ + +#include + +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + short f, b; + + initscr(); + cbreak(); + noecho(); + + if (has_colors()) { + start_color(); + + pair_content(0, &f, &b); + printw("pair 0 contains (%d,%d)\n", f, b); + getch(); + + printw("Initializing pair 1 to red/black\n"); + init_pair(1, COLOR_RED, COLOR_BLACK); + bkgdset(' ' | COLOR_PAIR(1)); + printw("RED/BLACK\n"); + getch(); + + printw("Initializing pair 2 to white/blue\n"); + init_pair(2, COLOR_WHITE, COLOR_BLUE); + bkgdset(' ' | COLOR_PAIR(2)); + printw("WHITE/BLUE\n"); + getch(); + + printw("Resetting colors to pair 0\n"); + bkgdset(' ' | COLOR_PAIR(0)); + printw("Default Colors\n"); + getch(); + + printw("Resetting colors to pair 1\n"); + bkgdset(' ' | COLOR_PAIR(1)); + printw("RED/BLACK\n"); + getch(); + + printw("Setting screen to pair 0\n"); + bkgd(' ' | COLOR_PAIR(0)); + getch(); + + printw("Setting screen to pair 1\n"); + bkgd(' ' | COLOR_PAIR(1)); + getch(); + + printw("Setting screen to pair 2\n"); + bkgd(' ' | COLOR_PAIR(2)); + getch(); + + printw("Setting screen to pair 0\n"); + bkgd(' ' | COLOR_PAIR(0)); + getch(); + + } else { + printw("This demo requires a color terminal"); + getch(); + } + endwin(); + + ExitProgram(EXIT_SUCCESS); +}