aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/lxdialog/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/lxdialog/util.c')
-rw-r--r--scripts/kconfig/lxdialog/util.c73
1 files changed, 67 insertions, 6 deletions
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
index 08f98b1c4bb3..358f9cc19c53 100644
--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -96,6 +96,66 @@ static void set_classic_theme(void)
96 DLG_COLOR(darrow, COLOR_GREEN, COLOR_WHITE, true); 96 DLG_COLOR(darrow, COLOR_GREEN, COLOR_WHITE, true);
97} 97}
98 98
99static void set_blackbg_theme(void)
100{
101 DLG_COLOR(screen, COLOR_RED, COLOR_BLACK, true);
102 DLG_COLOR(shadow, COLOR_BLACK, COLOR_BLACK, false);
103 DLG_COLOR(dialog, COLOR_WHITE, COLOR_BLACK, false);
104 DLG_COLOR(title, COLOR_RED, COLOR_BLACK, false);
105 DLG_COLOR(border, COLOR_BLACK, COLOR_BLACK, true);
106
107 DLG_COLOR(button_active, COLOR_YELLOW, COLOR_RED, false);
108 DLG_COLOR(button_inactive, COLOR_YELLOW, COLOR_BLACK, false);
109 DLG_COLOR(button_key_active, COLOR_YELLOW, COLOR_RED, true);
110 DLG_COLOR(button_key_inactive, COLOR_RED, COLOR_BLACK, false);
111 DLG_COLOR(button_label_active, COLOR_WHITE, COLOR_RED, false);
112 DLG_COLOR(button_label_inactive, COLOR_BLACK, COLOR_BLACK, true);
113
114 DLG_COLOR(inputbox, COLOR_YELLOW, COLOR_BLACK, false);
115 DLG_COLOR(inputbox_border, COLOR_YELLOW, COLOR_BLACK, false);
116
117 DLG_COLOR(searchbox, COLOR_YELLOW, COLOR_BLACK, false);
118 DLG_COLOR(searchbox_title, COLOR_YELLOW, COLOR_BLACK, true);
119 DLG_COLOR(searchbox_border, COLOR_BLACK, COLOR_BLACK, true);
120
121 DLG_COLOR(position_indicator, COLOR_RED, COLOR_BLACK, false);
122
123 DLG_COLOR(menubox, COLOR_YELLOW, COLOR_BLACK, false);
124 DLG_COLOR(menubox_border, COLOR_BLACK, COLOR_BLACK, true);
125
126 DLG_COLOR(item, COLOR_WHITE, COLOR_BLACK, false);
127 DLG_COLOR(item_selected, COLOR_WHITE, COLOR_RED, false);
128
129 DLG_COLOR(tag, COLOR_RED, COLOR_BLACK, false);
130 DLG_COLOR(tag_selected, COLOR_YELLOW, COLOR_RED, true);
131 DLG_COLOR(tag_key, COLOR_RED, COLOR_BLACK, false);
132 DLG_COLOR(tag_key_selected, COLOR_YELLOW, COLOR_RED, true);
133
134 DLG_COLOR(check, COLOR_YELLOW, COLOR_BLACK, false);
135 DLG_COLOR(check_selected, COLOR_YELLOW, COLOR_RED, true);
136
137 DLG_COLOR(uarrow, COLOR_RED, COLOR_BLACK, false);
138 DLG_COLOR(darrow, COLOR_RED, COLOR_BLACK, false);
139}
140
141/*
142 * Select color theme
143 */
144static int set_theme(const char *theme)
145{
146 int use_color = 1;
147 if (!theme)
148 set_classic_theme();
149 else if (strcmp(theme, "classic") == 0)
150 set_classic_theme();
151 else if (strcmp(theme, "blackbg") == 0)
152 set_blackbg_theme();
153 else if (strcmp(theme, "mono") == 0)
154 use_color = 0;
155
156 return use_color;
157}
158
99static void init_one_color(struct dialog_color *color) 159static void init_one_color(struct dialog_color *color)
100{ 160{
101 static int pair = 0; 161 static int pair = 0;
@@ -144,12 +204,13 @@ static void init_dialog_colors(void)
144/* 204/*
145 * Setup for color display 205 * Setup for color display
146 */ 206 */
147static void color_setup(void) 207static void color_setup(const char *theme)
148{ 208{
149 if (has_colors()) { /* Terminal supports color? */ 209 if (set_theme(theme)) {
150 start_color(); 210 if (has_colors()) { /* Terminal supports color? */
151 set_classic_theme(); 211 start_color();
152 init_dialog_colors(); 212 init_dialog_colors();
213 }
153 } 214 }
154 else 215 else
155 { 216 {
@@ -198,7 +259,7 @@ void init_dialog(void)
198 keypad(stdscr, TRUE); 259 keypad(stdscr, TRUE);
199 cbreak(); 260 cbreak();
200 noecho(); 261 noecho();
201 color_setup(); 262 color_setup(getenv("MENUCONFIG_COLOR"));
202 dialog_clear(); 263 dialog_clear();
203} 264}
204 265