]> ncurses.scripts.mit.edu Git - ncurses.git/blob - test/background.c
ncurses 5.5
[ncurses.git] / test / background.c
1 /*
2  * $Id: background.c,v 1.1 2003/12/07 00:06:33 tom Exp $
3  */
4
5 #include <test.priv.h>
6
7 int
8 main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED)
9 {
10     short f, b;
11
12     initscr();
13     cbreak();
14     noecho();
15
16     if (has_colors()) {
17         start_color();
18
19         pair_content(0, &f, &b);
20         printw("pair 0 contains (%d,%d)\n", f, b);
21         getch();
22
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();
28
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();
34
35         printw("Resetting colors to pair 0\n");
36         bkgdset(' ' | COLOR_PAIR(0));
37         printw("Default Colors\n");
38         getch();
39
40         printw("Resetting colors to pair 1\n");
41         bkgdset(' ' | COLOR_PAIR(1));
42         printw("RED/BLACK\n");
43         getch();
44
45         printw("Setting screen to pair 0\n");
46         bkgd(' ' | COLOR_PAIR(0));
47         getch();
48
49         printw("Setting screen to pair 1\n");
50         bkgd(' ' | COLOR_PAIR(1));
51         getch();
52
53         printw("Setting screen to pair 2\n");
54         bkgd(' ' | COLOR_PAIR(2));
55         getch();
56
57         printw("Setting screen to pair 0\n");
58         bkgd(' ' | COLOR_PAIR(0));
59         getch();
60
61     } else {
62         printw("This demo requires a color terminal");
63         getch();
64     }
65     endwin();
66
67     ExitProgram(EXIT_SUCCESS);
68 }