mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: LKML <linux-kernel@vger.kernel.org>,
	Roman Zippel <zippel@linux-m68k.org>,
	Andrew Morton <akpm@osdl.org>
Subject: [PATCH 2/3] kconfig/lxdialog: add support for color themes and add blackbg theme
Date: Mon, 24 Jul 2006 13:38:33 +0200	[thread overview]
Message-ID: <20060724113833.GC22806@mars.ravnborg.org> (raw)
In-Reply-To: <20060724113641.GA22806@mars.ravnborg.org>

>From 7ba8d280514c5caf48d36c0f02d9be139ec71e58 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@mars.ravnborg.org>
Date: Mon, 24 Jul 2006 12:55:29 +0200
Subject: [PATCH] kconfig/lxdialog: add support for color themes and add blackbg theme

The blackbg color scheme is made by: Han Boetes
To use the blackbg color theme use:
make MENUCONFIG_COLOR=blackbg menuconfig

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
 scripts/kconfig/lxdialog/dialog.h |    2 -
 scripts/kconfig/lxdialog/util.c   |   85 ++++++++++++++++++++++++++++++-------
 scripts/kconfig/mconf.c           |   14 ++++++
 3 files changed, 82 insertions(+), 19 deletions(-)

diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index aee89b3..d16bd6e 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -135,7 +135,6 @@ extern struct dlg_clr dlg_clr;
 /*
  * Global variables
  */
-extern bool use_colors;
 extern bool use_shadow;
 
 extern const char *backtitle;
@@ -150,7 +149,6 @@ void init_dialog(void);
 void end_dialog(void);
 void attr_clear(WINDOW * win, int height, int width, chtype attr);
 void dialog_clear(void);
-void color_setup(void);
 void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x);
 void print_button(WINDOW * win, const char *label, int y, int x, int selected);
 void print_title(WINDOW *dialog, const char *title, int width);
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
index b3cb449..e3b1462 100644
--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -21,9 +21,6 @@
 
 #include "dialog.h"
 
-/* use colors by default? */
-bool use_colors = 1;
-
 const char *backtitle = NULL;
 
 /* Default color scheme. atr is set for mono display */
@@ -60,6 +57,51 @@ struct dlg_clr dlg_clr = {
  .darrow                = DLG_CLR(A_BOLD,    COLOR_GREEN,  COLOR_WHITE,  true),
 };
 
+#define DLG_MODIFY(dlg,f,b,h) dlg_clr.dlg.fg = f; dlg_clr.dlg.bg = b; \
+                              dlg_clr.dlg.hl = h;
+/* Modify dlg_clr to selected theme */
+static void set_blackbg_theme(void)
+{
+	DLG_MODIFY(screen, COLOR_RED,   COLOR_BLACK, true);
+	DLG_MODIFY(shadow, COLOR_BLACK, COLOR_BLACK, false);
+	DLG_MODIFY(dialog, COLOR_WHITE, COLOR_BLACK, false);
+	DLG_MODIFY(title,  COLOR_RED,   COLOR_BLACK, false);
+	DLG_MODIFY(border, COLOR_BLACK, COLOR_BLACK, true);
+
+	DLG_MODIFY(button_active,         COLOR_YELLOW, COLOR_RED,   false);
+	DLG_MODIFY(button_inactive,       COLOR_YELLOW, COLOR_BLACK, false);
+	DLG_MODIFY(button_key_active,     COLOR_YELLOW, COLOR_RED,   true);
+	DLG_MODIFY(button_key_inactive,   COLOR_RED,    COLOR_BLACK, false);
+	DLG_MODIFY(button_label_active,   COLOR_WHITE,  COLOR_RED,   false);
+	DLG_MODIFY(button_label_inactive, COLOR_BLACK,  COLOR_BLACK, true);
+
+	DLG_MODIFY(inputbox,         COLOR_YELLOW, COLOR_BLACK, false);
+	DLG_MODIFY(inputbox_border,  COLOR_YELLOW, COLOR_BLACK, false);
+
+	DLG_MODIFY(searchbox,        COLOR_YELLOW, COLOR_BLACK, false);
+	DLG_MODIFY(searchbox_title,  COLOR_YELLOW, COLOR_BLACK, true);
+	DLG_MODIFY(searchbox_border, COLOR_BLACK,  COLOR_BLACK, true);
+
+	DLG_MODIFY(position_indicator, COLOR_RED, COLOR_BLACK,  false);
+
+	DLG_MODIFY(menubox,          COLOR_YELLOW, COLOR_BLACK, false);
+	DLG_MODIFY(menubox_border,   COLOR_BLACK,  COLOR_BLACK, true);
+
+	DLG_MODIFY(item,             COLOR_WHITE, COLOR_BLACK, false);
+	DLG_MODIFY(item_selected,    COLOR_WHITE, COLOR_RED,   false);
+
+	DLG_MODIFY(tag,              COLOR_RED,    COLOR_BLACK, false);
+	DLG_MODIFY(tag_selected,     COLOR_YELLOW, COLOR_RED,   true);
+	DLG_MODIFY(tag_key,          COLOR_RED,    COLOR_BLACK, false);
+	DLG_MODIFY(tag_key_selected, COLOR_YELLOW, COLOR_RED,   true);
+
+	DLG_MODIFY(check,            COLOR_YELLOW, COLOR_BLACK, false);
+	DLG_MODIFY(check_selected,   COLOR_YELLOW, COLOR_RED,   true);
+
+	DLG_MODIFY(uarrow, COLOR_RED, COLOR_BLACK, false);
+	DLG_MODIFY(darrow, COLOR_RED, COLOR_BLACK, false);
+}
+
 static void init_one_color(struct dialog_color *color)
 {
 	static int pair = 0;
@@ -106,6 +148,29 @@ static void init_dialog_colors(void)
 	init_one_color(&dlg_clr.darrow);
 }
 
+static int set_color_theme(const char *theme)
+{
+	int use_color = 1;
+	if (!strncasecmp (theme, "blackbg", sizeof("blackbg")))
+		set_blackbg_theme();
+	else if (!strncasecmp(theme, "mono", sizeof("mono")))
+		use_color = 0;
+	return use_color;
+}
+
+/*
+ * Setup for color display
+ */
+static void color_setup(const char *theme)
+{
+	if (set_color_theme(theme))
+		if (has_colors()) {	/* Terminal supports color? */
+			start_color();
+			init_dialog_colors();
+		}
+}
+
+
 /*
  * Set window to attribute 'attr'
  */
@@ -148,24 +213,12 @@ void init_dialog(void)
 	cbreak();
 	noecho();
 
-	if (use_colors)		/* Set up colors */
-		color_setup();
+	color_setup(getenv("MENUCONFIG_COLOR"));
 
 	dialog_clear();
 }
 
 /*
- * Setup for color display
- */
-void color_setup(void)
-{
-	if (has_colors()) {	/* Terminal supports color? */
-		start_color();
-		init_dialog_colors();
-	}
-}
-
-/*
  * End using dialog functions.
  */
 void end_dialog(void)
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 7f97319..d518161 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -159,7 +159,19 @@ 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"
+"\n"),
 menu_instructions[] = N_(
 	"Arrow keys navigate the menu.  "
 	"<Enter> selects submenus --->.  "
-- 
1.4.1.rc2.gfc04


  parent reply	other threads:[~2006-07-24 11:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-24 11:36 [PATCH 0/3] kconfig/lxdialog: color theme support Sam Ravnborg
2006-07-24 11:37 ` [PATCH 1/3] kconfig/lxdialog: refactored color settings Sam Ravnborg
2006-07-24 11:38 ` Sam Ravnborg [this message]
2006-07-24 12:25   ` [PATCH 2/3] kconfig/lxdialog: add support for color themes and add blackbg theme Roman Zippel
2006-07-24 13:04     ` Sam Ravnborg
2006-07-24 11:39 ` [PATCH 3/3] kconfig/lxdialog: add bluetitle color scheme Sam Ravnborg
2006-07-24 12:28   ` Roman Zippel
2006-07-24 13:15     ` Sam Ravnborg
2006-07-24 13:37       ` Roman Zippel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060724113833.GC22806@mars.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®