summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/lxdialog
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2006-07-24 22:04:04 +0200
committerSam Ravnborg <sam@neptun.ravnborg.org>2006-09-30 11:19:19 +0200
commit458972132a705c4a869002354f7f10f395d08c18 (patch)
treea96e2804fd4926f0ba8dd8039e5837fb4cc22485 /scripts/kconfig/lxdialog
parent98e5a1579e7d34fe3803240750a1c48efcd9cb15 (diff)
downloadlinux-458972132a705c4a869002354f7f10f395d08c18.tar.gz
linux-458972132a705c4a869002354f7f10f395d08c18.tar.bz2
linux-458972132a705c4a869002354f7f10f395d08c18.zip
kconfig/lxdialog: add support for color themes and add blackbg theme
The blackbg theme was originally made by: Han Boetes It was copied from a patch by "Randy.Dunlap" <rdunlap@xenotime.net> which was also the inspiration source for the color theme support. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig/lxdialog')
-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)
DLG_COLOR(darrow, COLOR_GREEN, COLOR_WHITE, true);
}
+static void set_blackbg_theme(void)
+{
+ DLG_COLOR(screen, COLOR_RED, COLOR_BLACK, true);
+ DLG_COLOR(shadow, COLOR_BLACK, COLOR_BLACK, false);
+ DLG_COLOR(dialog, COLOR_WHITE, COLOR_BLACK, false);
+ DLG_COLOR(title, COLOR_RED, COLOR_BLACK, false);
+ DLG_COLOR(border, COLOR_BLACK, COLOR_BLACK, true);
+
+ DLG_COLOR(button_active, COLOR_YELLOW, COLOR_RED, false);
+ DLG_COLOR(button_inactive, COLOR_YELLOW, COLOR_BLACK, false);
+ DLG_COLOR(button_key_active, COLOR_YELLOW, COLOR_RED, true);
+ DLG_COLOR(button_key_inactive, COLOR_RED, COLOR_BLACK, false);
+ DLG_COLOR(button_label_active, COLOR_WHITE, COLOR_RED, false);
+ DLG_COLOR(button_label_inactive, COLOR_BLACK, COLOR_BLACK, true);
+
+ DLG_COLOR(inputbox, COLOR_YELLOW, COLOR_BLACK, false);
+ DLG_COLOR(inputbox_border, COLOR_YELLOW, COLOR_BLACK, false);
+
+ DLG_COLOR(searchbox, COLOR_YELLOW, COLOR_BLACK, false);
+ DLG_COLOR(searchbox_title, COLOR_YELLOW, COLOR_BLACK, true);
+ DLG_COLOR(searchbox_border, COLOR_BLACK, COLOR_BLACK, true);
+
+ DLG_COLOR(position_indicator, COLOR_RED, COLOR_BLACK, false);
+
+ DLG_COLOR(menubox, COLOR_YELLOW, COLOR_BLACK, false);
+ DLG_COLOR(menubox_border, COLOR_BLACK, COLOR_BLACK, true);
+
+ DLG_COLOR(item, COLOR_WHITE, COLOR_BLACK, false);
+ DLG_COLOR(item_selected, COLOR_WHITE, COLOR_RED, false);
+
+ DLG_COLOR(tag, COLOR_RED, COLOR_BLACK, false);
+ DLG_COLOR(tag_selected, COLOR_YELLOW, COLOR_RED, true);
+ DLG_COLOR(tag_key, COLOR_RED, COLOR_BLACK, false);
+ DLG_COLOR(tag_key_selected, COLOR_YELLOW, COLOR_RED, true);
+
+ DLG_COLOR(check, COLOR_YELLOW, COLOR_BLACK, false);
+ DLG_COLOR(check_selected, COLOR_YELLOW, COLOR_RED, true);
+
+ DLG_COLOR(uarrow, COLOR_RED, COLOR_BLACK, false);
+ DLG_COLOR(darrow, COLOR_RED, COLOR_BLACK, false);
+}
+
+/*
+ * Select color theme
+ */
+static int set_theme(const char *theme)
+{
+ int use_color = 1;
+ if (!theme)
+ set_classic_theme();
+ else if (strcmp(theme, "classic") == 0)
+ set_classic_theme();
+ else if (strcmp(theme, "blackbg") == 0)
+ set_blackbg_theme();
+ else if (strcmp(theme, "mono") == 0)
+ use_color = 0;
+
+ return use_color;
+}
+
static void init_one_color(struct dialog_color *color)
{
static int pair = 0;
@@ -144,12 +204,13 @@ static void init_dialog_colors(void)
/*
* Setup for color display
*/
-static void color_setup(void)
+static void color_setup(const char *theme)
{
- if (has_colors()) { /* Terminal supports color? */
- start_color();
- set_classic_theme();
- init_dialog_colors();
+ if (set_theme(theme)) {
+ if (has_colors()) { /* Terminal supports color? */
+ start_color();
+ init_dialog_colors();
+ }
}
else
{
@@ -198,7 +259,7 @@ void init_dialog(void)
keypad(stdscr, TRUE);
cbreak();
noecho();
- color_setup();
+ color_setup(getenv("MENUCONFIG_COLOR"));
dialog_clear();
}