Skip to contentSkip to conversation

kconfig/lxdialog: color theme support

PATCH In review Sam Ravnborg 3 participants 8 messages Jul 25, 2006 – Jul 28, 2006 Kconfig

lore
Share & tools
lore
#0 lore raw

v2 cover kconfig/lxdialog: color theme support

Second iteration of the patchset to add color theme support to lxdialog. This patchset allow the menuconfig user to select between a number of different color themes for menuconfig:
blackbg, classic, mono and bluetitle

The latter is the default after applying this patchset. To select a color theme use:
make MENUCONFIG_COLOR=blackbg menuconfig

Changes since v1 of the patchset:
o Initial refactoring are now done so mono and classic are independent
o Renamed global variable to 'dlg' - the one containing the color definitions
o Moved backtitle to the global variable 'dlg' so we have a single global variable
o Added changes from Roman Zippel to bluetitle theme
o Made bluetitle theme default
o fix of SEGV when no theme was specified

The patchset is also available at:
git://git.kernel.org/pub/scm/linux/kernel/sam/lxdialog.git

Sam

#1 lore raw

PATCH v2 1/3 kconfig/lxdialog: refactor color support

Quoted 1 line

From 9238251dddc15b52656e70b74dffe56193d01215 Mon Sep 17 00:00:00 2001

From: Sam Ravnborg <[email protected]>
Date: Mon, 24 Jul 2006 21:40:46 +0200
Subject: [PATCH] kconfig/lxdialog: refactor color support

Clean up and refactor color support. All color support are now in util.c including color definitions.
In the process introduced a global variable named 'dlg' which is used all over to set color - thats the reason why all files are changed.

---
 scripts/kconfig/lxdialog/checklist.c |   28 ++--
 scripts/kconfig/lxdialog/colors.h    |  154 --------------------
 scripts/kconfig/lxdialog/dialog.h    |   82 +++++------
 scripts/kconfig/lxdialog/inputbox.c  |   18 +-
 scripts/kconfig/lxdialog/lxdialog.c  |    6 -
 scripts/kconfig/lxdialog/menubox.c   |   28 ++--
 scripts/kconfig/lxdialog/msgbox.c    |    9 +
 scripts/kconfig/lxdialog/textbox.c   |   19 +-
 scripts/kconfig/lxdialog/util.c      |  259 +++++++++++++++++++---------------
 scripts/kconfig/lxdialog/yesno.c     |    9 +
 10 files changed, 250 insertions(+), 362 deletions(-)
scripts/kconfig/lxdialog/checklist.c +15 -13
index 7988641..b90e888 100644
@@ -34,18 +34,19 @@ static void print_item(WINDOW * win, con
 	int i;
 
 	/* Clear 'residue' of last item */
-	wattrset(win, menubox_attr);
+	wattrset(win, dlg.menubox.atr);
 	wmove(win, choice, 0);
 	for (i = 0; i < list_width; i++)
 		waddch(win, ' ');
 
 	wmove(win, choice, check_x);
-	wattrset(win, selected ? check_selected_attr : check_attr);
+	wattrset(win, selected ? dlg.check_selected.atr
+		 : dlg.check.atr);
 	wprintw(win, "(%c)", status ? 'X' : ' ');
 
-	wattrset(win, selected ? tag_selected_attr : tag_attr);
+	wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr);
 	mvwaddch(win, choice, item_x, item[0]);
-	wattrset(win, selected ? item_selected_attr : item_attr);
+	wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
 	waddstr(win, (char *)item + 1);
 	if (selected) {
 		wmove(win, choice, check_x + 1);
@@ -62,11 +63,11 @@ static void print_arrows(WINDOW * win, i
 	wmove(win, y, x);
 
 	if (scroll > 0) {
-		wattrset(win, uarrow_attr);
+		wattrset(win, dlg.uarrow.atr);
 		waddch(win, ACS_UARROW);
 		waddstr(win, "(-)");
 	} else {
-		wattrset(win, menubox_attr);
+		wattrset(win, dlg.menubox.atr);
 		waddch(win, ACS_HLINE);
 		waddch(win, ACS_HLINE);
 		waddch(win, ACS_HLINE);
@@ -77,11 +78,11 @@ static void print_arrows(WINDOW * win, i
 	wmove(win, y, x);
 
 	if ((height < item_no) && (scroll + choice < item_no - 1)) {
-		wattrset(win, darrow_attr);
+		wattrset(win, dlg.darrow.atr);
 		waddch(win, ACS_DARROW);
 		waddstr(win, "(+)");
 	} else {
-		wattrset(win, menubox_border_attr);
+		wattrset(win, dlg.menubox_border.atr);
 		waddch(win, ACS_HLINE);
 		waddch(win, ACS_HLINE);
 		waddch(win, ACS_HLINE);
@@ -145,17 +146,18 @@ int dialog_checklist(const char *title, 
 	dialog = newwin(height, width, y, x);
 	keypad(dialog, TRUE);
 
-	draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
-	wattrset(dialog, border_attr);
+	draw_box(dialog, 0, 0, height, width,
+		 dlg.dialog.atr, dlg.border.atr);
+	wattrset(dialog, dlg.border.atr);
 	mvwaddch(dialog, height - 3, 0, ACS_LTEE);
 	for (i = 0; i < width - 2; i++)
 		waddch(dialog, ACS_HLINE);
-	wattrset(dialog, dialog_attr);
+	wattrset(dialog, dlg.dialog.atr);
 	waddch(dialog, ACS_RTEE);
 
 	print_title(dialog, title, width);
 
-	wattrset(dialog, dialog_attr);
+	wattrset(dialog, dlg.dialog.atr);
 	print_autowrap(dialog, prompt, width - 2, 1, 3);
 
 	list_width = width - 6;
@@ -170,7 +172,7 @@ int dialog_checklist(const char *title, 
 
 	/* draw a box around the list items */
 	draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2,
-	         menubox_border_attr, menubox_attr);
+	         dlg.menubox_border.atr, dlg.menubox.atr);
 
 	/* Find length of longest item in order to center checklist */
 	check_x = 0;
scripts/kconfig/lxdialog/colors.h deleted +0 -154

154 lines not on this page · raw message

scripts/kconfig/lxdialog/dialog.h +40 -42

102 lines not on this page · raw message

scripts/kconfig/lxdialog/inputbox.c +10 -8
index 7795037..f75b51f 100644
@@ -58,17 +58,18 @@ int dialog_inputbox(const char *title, c
 	dialog = newwin(height, width, y, x);
 	keypad(dialog, TRUE);
 
-	draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
-	wattrset(dialog, border_attr);
+	draw_box(dialog, 0, 0, height, width,
+		 dlg.dialog.atr, dlg.border.atr);
+	wattrset(dialog, dlg.border.atr);
 	mvwaddch(dialog, height - 3, 0, ACS_LTEE);
 	for (i = 0; i < width - 2; i++)
 		waddch(dialog, ACS_HLINE);
-	wattrset(dialog, dialog_attr);
+	wattrset(dialog, dlg.dialog.atr);
 	waddch(dialog, ACS_RTEE);
 
 	print_title(dialog, title, width);
 
-	wattrset(dialog, dialog_attr);
+	wattrset(dialog, dlg.dialog.atr);
 	print_autowrap(dialog, prompt, width - 2, 1, 3);
 
 	/* Draw the input field box */
@@ -76,13 +77,14 @@ int dialog_inputbox(const char *title, c
 	getyx(dialog, y, x);
 	box_y = y + 2;
 	box_x = (width - box_width) / 2;
-	draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2, border_attr, dialog_attr);
+	draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2,
+		 dlg.border.atr, dlg.dialog.atr);
 
 	print_buttons(dialog, height, width, 0);
 
 	/* Set up the initial value */
 	wmove(dialog, box_y, box_x);
-	wattrset(dialog, inputbox_attr);
+	wattrset(dialog, dlg.inputbox.atr);
 
 	if (!init)
 		instr[0] = '\0';
@@ -120,7 +122,7 @@ int dialog_inputbox(const char *title, c
 			case KEY_BACKSPACE:
 			case 127:
 				if (input_x || scroll) {
-					wattrset(dialog, inputbox_attr);
+					wattrset(dialog, dlg.inputbox.atr);
 					if (!input_x) {
 						scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1);
 						wmove(dialog, box_y, box_x);
@@ -140,7 +142,7 @@ int dialog_inputbox(const char *title, c
 			default:
 				if (key < 0x100 && isprint(key)) {
 					if (scroll + input_x < MAX_LEN) {
-						wattrset(dialog, inputbox_attr);
+						wattrset(dialog, dlg.inputbox.atr);
 						instr[scroll + input_x] = key;
 						instr[scroll + input_x + 1] = '\0';
 						if (input_x == box_width - 1) {
scripts/kconfig/lxdialog/lxdialog.c +3 -3
index 79f6c5f..c264e02 100644
@@ -78,11 +78,11 @@ #endif
 				offset += 2;
 			}
 		} else if (!strcmp(argv[offset + 1], "--backtitle")) {
-			if (backtitle != NULL) {
+			if (dlg.backtitle != NULL) {
 				Usage(argv[0]);
 				exit(-1);
 			} else {
-				backtitle = argv[offset + 2];
+				dlg.backtitle = argv[offset + 2];
 				offset += 2;
 			}
 		} else if (!strcmp(argv[offset + 1], "--clear")) {
@@ -123,7 +123,7 @@ #endif
 	retval = (*(modePtr->jumper)) (title, argc - offset, argv + offset);
 
 	if (opt_clear) {	/* clear screen before exit */
-		attr_clear(stdscr, LINES, COLS, screen_attr);
+		attr_clear(stdscr, LINES, COLS, dlg.screen.atr);
 		refresh();
 	}
 	end_dialog();
scripts/kconfig/lxdialog/menubox.c +15 -13
index bf8052f..ff991db 100644
@@ -74,7 +74,7 @@ static void do_print_item(WINDOW * win, 
 	j = first_alpha(menu_item, "YyNnMmHh");
 
 	/* Clear 'residue' of last item */
-	wattrset(win, menubox_attr);
+	wattrset(win, dlg.menubox.atr);
 	wmove(win, choice, 0);
 #if OLD_NCURSES
 	{
@@ -85,10 +85,11 @@ #if OLD_NCURSES
 #else
 	wclrtoeol(win);
 #endif
-	wattrset(win, selected ? item_selected_attr : item_attr);
+	wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
 	mvwaddstr(win, choice, item_x, menu_item);
 	if (hotkey) {
-		wattrset(win, selected ? tag_key_selected_attr : tag_key_attr);
+		wattrset(win, selected ? dlg.tag_key_selected.atr
+			 : dlg.tag_key.atr);
 		mvwaddch(win, choice, item_x + j, menu_item[j]);
 	}
 	if (selected) {
@@ -117,11 +118,11 @@ static void print_arrows(WINDOW * win, i
 	wmove(win, y, x);
 
 	if (scroll > 0) {
-		wattrset(win, uarrow_attr);
+		wattrset(win, dlg.uarrow.atr);
 		waddch(win, ACS_UARROW);
 		waddstr(win, "(-)");
 	} else {
-		wattrset(win, menubox_attr);
+		wattrset(win, dlg.menubox.atr);
 		waddch(win, ACS_HLINE);
 		waddch(win, ACS_HLINE);
 		waddch(win, ACS_HLINE);
@@ -133,11 +134,11 @@ static void print_arrows(WINDOW * win, i
 	wrefresh(win);
 
 	if ((height < item_no) && (scroll + height < item_no)) {
-		wattrset(win, darrow_attr);
+		wattrset(win, dlg.darrow.atr);
 		waddch(win, ACS_DARROW);
 		waddstr(win, "(+)");
 	} else {
-		wattrset(win, menubox_border_attr);
+		wattrset(win, dlg.menubox_border.atr);
 		waddch(win, ACS_HLINE);
 		waddch(win, ACS_HLINE);
 		waddch(win, ACS_HLINE);
@@ -199,18 +200,19 @@ int dialog_menu(const char *title, const
 	dialog = newwin(height, width, y, x);
 	keypad(dialog, TRUE);
 
-	draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
-	wattrset(dialog, border_attr);
+	draw_box(dialog, 0, 0, height, width,
+		 dlg.dialog.atr, dlg.border.atr);
+	wattrset(dialog, dlg.border.atr);
 	mvwaddch(dialog, height - 3, 0, ACS_LTEE);
 	for (i = 0; i < width - 2; i++)
 		waddch(dialog, ACS_HLINE);
-	wattrset(dialog, dialog_attr);
-	wbkgdset(dialog, dialog_attr & A_COLOR);
+	wattrset(dialog, dlg.dialog.atr);
+	wbkgdset(dialog, dlg.dialog.atr & A_COLOR);
 	waddch(dialog, ACS_RTEE);
 
 	print_title(dialog, title, width);
 
-	wattrset(dialog, dialog_attr);
+	wattrset(dialog, dlg.dialog.atr);
 	print_autowrap(dialog, prompt, width - 2, 1, 3);
 
 	menu_width = width - 6;
@@ -224,7 +226,7 @@ int dialog_menu(const char *title, const
 
 	/* draw a box around the menu items */
 	draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2,
-		 menubox_border_attr, menubox_attr);
+		 dlg.menubox_border.atr, dlg.menubox.atr);
 
 	item_x = (menu_width - 70) / 2;
 
scripts/kconfig/lxdialog/msgbox.c +5 -4
index 7323f54..236759f 100644
@@ -40,19 +40,20 @@ int dialog_msgbox(const char *title, con
 	dialog = newwin(height, width, y, x);
 	keypad(dialog, TRUE);
 
-	draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
+	draw_box(dialog, 0, 0, height, width,
+		 dlg.dialog.atr, dlg.border.atr);
 
 	print_title(dialog, title, width);
 
-	wattrset(dialog, dialog_attr);
+	wattrset(dialog, dlg.dialog.atr);
 	print_autowrap(dialog, prompt, width - 2, 1, 2);
 
 	if (pause) {
-		wattrset(dialog, border_attr);
+		wattrset(dialog, dlg.border.atr);
 		mvwaddch(dialog, height - 3, 0, ACS_LTEE);
 		for (i = 0; i < width - 2; i++)
 			waddch(dialog, ACS_HLINE);
-		wattrset(dialog, dialog_attr);
+		wattrset(dialog, dlg.dialog.atr);
 		waddch(dialog, ACS_RTEE);
 
 		print_button(dialog, "  Ok  ", height - 2, width / 2 - 4, TRUE);
scripts/kconfig/lxdialog/textbox.c +10 -9
index 77848bb..336793b 100644
@@ -87,20 +87,21 @@ int dialog_textbox(const char *title, co
 
 	/* Create window for text region, used for scrolling text */
 	text = subwin(dialog, height - 4, width - 2, y + 1, x + 1);
-	wattrset(text, dialog_attr);
-	wbkgdset(text, dialog_attr & A_COLOR);
+	wattrset(text, dlg.dialog.atr);
+	wbkgdset(text, dlg.dialog.atr & A_COLOR);
 
 	keypad(text, TRUE);
 
 	/* register the new window, along with its borders */
-	draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
+	draw_box(dialog, 0, 0, height, width,
+		 dlg.dialog.atr, dlg.border.atr);
 
-	wattrset(dialog, border_attr);
+	wattrset(dialog, dlg.border.atr);
 	mvwaddch(dialog, height - 3, 0, ACS_LTEE);
 	for (i = 0; i < width - 2; i++)
 		waddch(dialog, ACS_HLINE);
-	wattrset(dialog, dialog_attr);
-	wbkgdset(dialog, dialog_attr & A_COLOR);
+	wattrset(dialog, dlg.dialog.atr);
+	wbkgdset(dialog, dlg.dialog.atr & A_COLOR);
 	waddch(dialog, ACS_RTEE);
 
 	print_title(dialog, title, width);
@@ -110,7 +111,7 @@ int dialog_textbox(const char *title, co
 	getyx(dialog, cur_y, cur_x);	/* Save cursor position */
 
 	/* Print first page of text */
-	attr_clear(text, height - 4, width - 2, dialog_attr);
+	attr_clear(text, height - 4, width - 2, dlg.dialog.atr);
 	print_page(text, height - 4, width - 2);
 	print_position(dialog, height, width);
 	wmove(dialog, cur_y, cur_x);	/* Restore cursor position */
@@ -524,8 +525,8 @@ static void print_position(WINDOW * win,
 		fprintf(stderr, "\nError moving file pointer in print_position().\n");
 		exit(-1);
 	}
-	wattrset(win, position_indicator_attr);
-	wbkgdset(win, position_indicator_attr & A_COLOR);
+	wattrset(win, dlg.position_indicator.atr);
+	wbkgdset(win, dlg.position_indicator.atr & A_COLOR);
 	percent = !file_size ?
 	    100 : ((fpos - bytes_read + page - buf) * 100) / file_size;
 	wmove(win, height - 3, width - 9);
scripts/kconfig/lxdialog/util.c +147 -112

314 lines not on this page · raw message

scripts/kconfig/lxdialog/yesno.c +5 -4
index cb2568a..e938037 100644
@@ -53,17 +53,18 @@ int dialog_yesno(const char *title, cons
 	dialog = newwin(height, width, y, x);
 	keypad(dialog, TRUE);
 
-	draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr);
-	wattrset(dialog, border_attr);
+	draw_box(dialog, 0, 0, height, width,
+		 dlg.dialog.atr, dlg.border.atr);
+	wattrset(dialog, dlg.border.atr);
 	mvwaddch(dialog, height - 3, 0, ACS_LTEE);
 	for (i = 0; i < width - 2; i++)
 		waddch(dialog, ACS_HLINE);
-	wattrset(dialog, dialog_attr);
+	wattrset(dialog, dlg.dialog.atr);
 	waddch(dialog, ACS_RTEE);
 
 	print_title(dialog, title, width);
 
-	wattrset(dialog, dialog_attr);
+	wattrset(dialog, dlg.dialog.atr);
 	print_autowrap(dialog, prompt, width - 2, 1, 3);
 
 	print_buttons(dialog, height, width, 0);
Signature · 1 line
1.4.1.rc2.gfc04
#2 lore raw

PATCH v2 2/3 kconfig/lxdialog: add support for color themes and add blackbg theme

In reply to Sam Ravnborg
Quoted 1 line

From cd0125d4c9bc9c2192a265989b1c60e94cd398b3 Mon Sep 17 00:00:00 2001

From: Sam Ravnborg <[email protected]>
Date: Mon, 24 Jul 2006 22:04:04 +0200
Subject: [PATCH] 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" <[email protected]> which was also the inspiration source for the color theme support.

---
 scripts/kconfig/lxdialog/util.c |   73 ++++++++++++++++++++++++++++++++++++---
 scripts/kconfig/mconf.c         |   15 +++++++-
 2 files changed, 81 insertions(+), 7 deletions(-)
scripts/kconfig/lxdialog/util.c +67 -6
index 08f98b1..358f9cc 100644
@@ -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();
 }
 
scripts/kconfig/mconf.c +14 -1
index 7f97319..ed22b13 100644
@@ -159,7 +159,20 @@ static const char mconf_readme[] = N_(
 "\n"
 "Note that this mode can eventually be a little more CPU expensive\n"
 "(especially with a larger number of unrolled categories) than the\n"
-"default mode.\n"),
+"default mode.\n"
+"\n"
+"Different color themes available\n"
+"--------------------------------\n"
+"It is possible to select different color themes using the variable\n"
+"MENUCONFIG_COLOR. To select a theme use:\n"
+"\n"
+"make MENUCONFIG_COLOR=<theme> menuconfig\n"
+"\n"
+"Available themes are\n"
+" mono       => selects colors suitable for monochrome displays\n"
+" blackbg    => selects a color scheme with black background\n"
+" classic    => theme with blue background. The classic look. (default)\n"
+"\n"),
 menu_instructions[] = N_(
 	"Arrow keys navigate the menu.  "
 	"<Enter> selects submenus --->.  "
Signature · 1 line
1.4.1.rc2.gfc04
#3 lore raw

PATCH v2 3/3 kconfig/lxdialog: add a new theme bluetitle which is now default

In reply to Sam Ravnborg
Quoted 1 line

From 0caea54a7495001f8192c4c1558711bc4200c910 Mon Sep 17 00:00:00 2001

From: Sam Ravnborg <[email protected]>
Date: Mon, 24 Jul 2006 22:19:51 +0200
Subject: [PATCH] kconfig/lxdialog: add a new theme bluetitle which is now default

The bluetitle theme is a slightly modified version of the colorscheme that -mm users has been used to. The bluetitle is more readable especially on some LCD screens so it is now default.
Anyone that really wants the old color selection can get it by selecting the classic color theme:
make MENUCONFIG_COLOR=classic menuconfig

The bluetitle theme was modified by Roman Zippel <[email protected]> to further improve readability on LCD screens.

---
 scripts/kconfig/lxdialog/util.c |   17 ++++++++++++++++-
 scripts/kconfig/mconf.c         |    3 ++-
 2 files changed, 18 insertions(+), 2 deletions(-)
scripts/kconfig/lxdialog/util.c +16 -1
index 358f9cc..e73a36d 100644
@@ -138,6 +138,19 @@ static void set_blackbg_theme(void)
 	DLG_COLOR(darrow, COLOR_RED, COLOR_BLACK, false);
 }
 
+static void set_bluetitle_theme(void)
+{
+	set_classic_theme();
+	DLG_COLOR(title,               COLOR_BLUE,   COLOR_WHITE, true);
+	DLG_COLOR(button_key_active,   COLOR_YELLOW, COLOR_BLUE,  true);
+	DLG_COLOR(button_label_active, COLOR_WHITE,  COLOR_BLUE,  true);
+	DLG_COLOR(searchbox_title,     COLOR_BLUE,   COLOR_WHITE, true);
+	DLG_COLOR(position_indicator,  COLOR_BLUE,   COLOR_WHITE, true);
+	DLG_COLOR(tag,                 COLOR_BLUE,   COLOR_WHITE, true);
+	DLG_COLOR(tag_key,             COLOR_BLUE,   COLOR_WHITE, true);
+
+}
+
 /*
  * Select color theme
  */
@@ -145,9 +158,11 @@ static int set_theme(const char *theme)
 {
 	int use_color = 1;
 	if (!theme)
-		set_classic_theme();
+		set_bluetitle_theme();
 	else if (strcmp(theme, "classic") == 0)
 		set_classic_theme();
+	else if (strcmp(theme, "bluetitle") == 0)
+		set_bluetitle_theme();
 	else if (strcmp(theme, "blackbg") == 0)
 		set_blackbg_theme();
 	else if (strcmp(theme, "mono") == 0)
scripts/kconfig/mconf.c +2 -1
index ed22b13..5992673 100644
@@ -171,7 +171,8 @@ static const char mconf_readme[] = N_(
 "Available themes are\n"
 " mono       => selects colors suitable for monochrome displays\n"
 " blackbg    => selects a color scheme with black background\n"
-" classic    => theme with blue background. The classic look. (default)\n"
+" classic    => theme with blue background. The classic look\n"
+" bluetitle  => a LCD friendly version of classic. (default)\n"
 "\n"),
 menu_instructions[] = N_(
 	"Arrow keys navigate the menu.  "
Signature · 1 line
1.4.1.rc2.gfc04
#4 lore raw
In reply to Sam Ravnborg
Quoted 19 lines · Sam Ravnborg

Second iteration of the patchset to add color theme support to lxdialog. This patchset allow the menuconfig user to select between a number of different color themes for menuconfig:
blackbg, classic, mono and bluetitle

The latter is the default after applying this patchset. To select a color theme use:
make MENUCONFIG_COLOR=blackbg menuconfig

Changes since v1 of the patchset:
o Initial refactoring are now done so mono and classic are independent
o Renamed global variable to 'dlg' - the one containing the color definitions
o Moved backtitle to the global variable 'dlg' so we have a single global variable
o Added changes from Roman Zippel to bluetitle theme
o Made bluetitle theme default
o fix of SEGV when no theme was specified

Quoted 2 lines

The patchset is also available at:
git://git.kernel.org/pub/scm/linux/kernel/sam/lxdialog.git

Make that:
git://git.kernel.org/pub/scm/linux/kernel/git/sam/lxdialog.git

Sam

Acked-by on the v2 series
#5 lore raw
In reply to Sam Ravnborg

Hi,

Quoted 4 lines · Sam Ravnborg

Second iteration of the patchset to add color theme support to lxdialog. This patchset allow the menuconfig user to select between a number of different color themes for menuconfig:
blackbg, classic, mono and bluetitle

Looks good.

bye, Roman

#6 lore raw
Quoted 5 lines

Second iteration of the patchset to add color theme support to lxdialog. This patchset allow the menuconfig user to select between a number of different color themes for menuconfig:
blackbg, classic, mono and bluetitle

Ain't nobody say the kernel lacks customization!

It would have been nice to do the following,

util.c +5 -0
diff --fast -Ndpru -x '*.cmd' lxdialog~/util.c lxdialog/util.c
@@ -63,6 +63,42 @@ do {                               \
 	dlg.dialog.hl = (h);       \
 } while (0)
 
+static void set_classiciv_theme(void)
+{
+	dlg = (const struct dialog_info){
+		.screen                = {0, COLOR_CYAN,   COLOR_BLUE,  true},
+		.shadow                = {0, COLOR_BLACK,  COLOR_BLACK, true},

...
+ .uarrow = {0, COLOR_GREEN, COLOR_WHITE, true},
+ .darrow = {0, COLOR_GREEN, COLOR_WHITE, true},
+ };
+ return;
+}

Which uses a nice memcpy call rather than tons of MOVs (assembler insns). Unfortuantely it truncates ->title.

Jan Engelhardt

#7 lore raw
Quoted 29 lines · Jan Engelhardt
Quoted 5 lines

Second iteration of the patchset to add color theme support to lxdialog. This patchset allow the menuconfig user to select between a number of different color themes for menuconfig:
blackbg, classic, mono and bluetitle

Ain't nobody say the kernel lacks customization!

It would have been nice to do the following,

diff --fast -Ndpru -x '*.cmd' lxdialog~/util.c lxdialog/util.c

util.c +10 -0
@@ -63,6 +63,42 @@ do {                               \
 	dlg.dialog.hl = (h);       \
 } while (0)
 
+static void set_classiciv_theme(void)
+{
+	dlg = (const struct dialog_info){
+		.screen                = {0, COLOR_CYAN,   COLOR_BLUE,  true},
+		.shadow                = {0, COLOR_BLACK,  COLOR_BLACK, true},
...
+		.uarrow                = {0, COLOR_GREEN,  COLOR_WHITE, true},
+ 		.darrow                = {0, COLOR_GREEN,  COLOR_WHITE, true},
+	};
+	return;
+}
Quoted 2 lines

Which uses a nice memcpy call rather than tons of MOVs (assembler insns). Unfortuantely it truncates ->title.

Current schme allows us to have a grand master theme that can be default and then justified as needed - like in the 'bluetitle' case.

And for this purposes this is all about readability and not code-speed.

Sam