HAMMER Utilities: Sync with 60F
[dragonfly.git] / contrib / ncurses-5.4 / test / background.c
blob7b1d22746c7281aa3fe71903c0ebcb46e71a48d1
1 /*
2 * $Id: background.c,v 1.1 2003/12/07 00:06:33 tom Exp $
3 */
5 #include <test.priv.h>
7 int
8 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
10 short f, b;
12 initscr();
13 cbreak();
14 noecho();
16 if (has_colors()) {
17 start_color();
19 pair_content(0, &f, &b);
20 printw("pair 0 contains (%d,%d)\n", f, b);
21 getch();
23 printw("Initializing pair 1 to red/black\n");
24 init_pair(1, COLOR_RED, COLOR_BLACK);
25 bkgdset(' ' | COLOR_PAIR(1));
26 printw("RED/BLACK\n");
27 getch();
29 printw("Initializing pair 2 to white/blue\n");
30 init_pair(2, COLOR_WHITE, COLOR_BLUE);
31 bkgdset(' ' | COLOR_PAIR(2));
32 printw("WHITE/BLUE\n");
33 getch();
35 printw("Resetting colors to pair 0\n");
36 bkgdset(' ' | COLOR_PAIR(0));
37 printw("Default Colors\n");
38 getch();
40 printw("Resetting colors to pair 1\n");
41 bkgdset(' ' | COLOR_PAIR(1));
42 printw("RED/BLACK\n");
43 getch();
45 printw("Setting screen to pair 0\n");
46 bkgd(' ' | COLOR_PAIR(0));
47 getch();
49 printw("Setting screen to pair 1\n");
50 bkgd(' ' | COLOR_PAIR(1));
51 getch();
53 printw("Setting screen to pair 2\n");
54 bkgd(' ' | COLOR_PAIR(2));
55 getch();
57 printw("Setting screen to pair 0\n");
58 bkgd(' ' | COLOR_PAIR(0));
59 getch();
61 } else {
62 printw("This demo requires a color terminal");
63 getch();
65 endwin();
67 ExitProgram(EXIT_SUCCESS);