Initial Import
[profile/ivi/alsa-utils.git] / alsamixer / colors.c
1 /*
2  * colors.c - color and attribute definitions
3  * Copyright (c) 1998,1999 Tim Janik
4  *                         Jaroslav Kysela <perex@perex.cz>
5  * Copyright (c) 2009      Clemens Ladisch <clemens@ladisch.de>
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #include "aconfig.h"
22 #include CURSESINC
23 #include "colors.h"
24
25 int attr_mixer_frame;
26 int attr_mixer_text;
27 int attr_mixer_active;
28 int attr_ctl_frame;
29 int attr_ctl_mute;
30 int attr_ctl_nomute;
31 int attr_ctl_capture;
32 int attr_ctl_nocapture;
33 int attr_ctl_label;
34 int attr_ctl_label_focus;
35 int attr_ctl_mark_focus;
36 int attr_ctl_bar_lo;
37 #ifdef TRICOLOR_VOLUME_BAR
38 int attr_ctl_bar_mi;
39 int attr_ctl_bar_hi;
40 #endif
41 int attr_ctl_inactive;
42 int attr_ctl_label_inactive;
43 int attr_errormsg;
44 int attr_infomsg;
45 int attr_textbox;
46 int attr_textfield;
47 int attr_menu;
48 int attr_menu_selected;
49
50 void init_colors(int use_color)
51 {
52         if (!!has_colors() == !!use_color) {
53                 start_color();
54
55                 init_pair(1, COLOR_CYAN, COLOR_BLACK);
56                 init_pair(2, COLOR_YELLOW, COLOR_BLACK);
57                 init_pair(3, COLOR_WHITE, COLOR_GREEN);
58                 init_pair(4, COLOR_RED, COLOR_BLACK);
59                 init_pair(5, COLOR_WHITE, COLOR_BLACK);
60                 init_pair(6, COLOR_WHITE, COLOR_BLUE);
61                 init_pair(7, COLOR_RED, COLOR_BLUE);
62                 init_pair(8, COLOR_GREEN, COLOR_GREEN);
63                 init_pair(9, COLOR_WHITE, COLOR_RED);
64 #ifdef TRICOLOR_VOLUME_BAR
65                 init_pair(10, COLOR_WHITE, COLOR_WHITE);
66                 init_pair(11, COLOR_RED, COLOR_RED);
67 #endif
68
69                 attr_mixer_frame = COLOR_PAIR(1);
70                 attr_mixer_text = COLOR_PAIR(1);
71                 attr_mixer_active = A_BOLD | COLOR_PAIR(2);
72                 attr_ctl_frame = A_BOLD | COLOR_PAIR(1);
73                 attr_ctl_mute = COLOR_PAIR(1);
74                 attr_ctl_nomute = A_BOLD | COLOR_PAIR(3);
75                 attr_ctl_capture = A_BOLD | COLOR_PAIR(4);
76                 attr_ctl_nocapture = COLOR_PAIR(5);
77                 attr_ctl_label = A_BOLD | COLOR_PAIR(6);
78                 attr_ctl_label_focus = A_BOLD | COLOR_PAIR(7);
79                 attr_ctl_mark_focus = A_BOLD | COLOR_PAIR(4);
80                 attr_ctl_bar_lo = A_BOLD | COLOR_PAIR(8);
81 #ifdef TRICOLOR_VOLUME_BAR
82                 attr_ctl_bar_mi = A_BOLD | COLOR_PAIR(10);
83                 attr_ctl_bar_hi = A_BOLD | COLOR_PAIR(11);
84 #endif
85                 attr_ctl_inactive = COLOR_PAIR(5);
86                 attr_ctl_label_inactive = A_REVERSE | COLOR_PAIR(5);
87                 attr_errormsg = A_BOLD | COLOR_PAIR(9);
88                 attr_infomsg = A_BOLD | COLOR_PAIR(6);
89                 attr_textbox = A_BOLD | COLOR_PAIR(6);
90                 attr_textfield = A_REVERSE | COLOR_PAIR(5);
91                 attr_menu = A_BOLD | COLOR_PAIR(6);
92                 attr_menu_selected = A_REVERSE | COLOR_PAIR(6);
93         } else {
94                 attr_mixer_frame = A_NORMAL;
95                 attr_mixer_text = A_NORMAL;
96                 attr_mixer_active = A_BOLD;
97                 attr_ctl_frame = A_BOLD;
98                 attr_ctl_mute = A_NORMAL;
99                 attr_ctl_nomute = A_BOLD;
100                 attr_ctl_capture = A_BOLD;
101                 attr_ctl_nocapture = A_NORMAL;
102                 attr_ctl_label = A_REVERSE;
103                 attr_ctl_label_focus = A_REVERSE | A_BOLD;
104                 attr_ctl_mark_focus = A_BOLD;
105                 attr_ctl_bar_lo = A_BOLD;
106 #ifdef TRICOLOR_VOLUME_BAR
107                 attr_ctl_bar_mi = A_BOLD;
108                 attr_ctl_bar_hi = A_BOLD;
109 #endif
110                 attr_ctl_inactive = A_NORMAL;
111                 attr_ctl_label_inactive = A_REVERSE;
112                 attr_errormsg = A_STANDOUT;
113                 attr_infomsg = A_NORMAL;
114                 attr_textbox = A_NORMAL;
115                 attr_textfield = A_REVERSE;
116                 attr_menu = A_NORMAL;
117                 attr_menu_selected = A_REVERSE;
118         }
119 }