Hi everybody,
I would like to modify color settings to my needs, but they are hard coded.
Any chance the move defines to a separate file config/menu.h?
Patch is attached, it should not change ipxe's current behavior.
--
main(a,b){char*/* Schoene Gruesse */c="B?IJj;M"
"EHCX:;";for(a/* Chris get my mail address: */=0;b=c[a++];)
putchar(b-1/(/* gcc -o sig sig.c && ./sig */b/42*2-3)*42);}
diff --git a/src/config/menu.h b/src/config/menu.h
index e69de29..e5d409e 100644
--- a/src/config/menu.h
+++ b/src/config/menu.h
@@ -0,0 +1,28 @@
+#ifndef CONFIG_MENU_H
+#define CONFIG_MENU_H
+
+#define MENU_COLOR_NORMAL_FG COLOR_WHITE
+#define MENU_COLOR_NORMAL_BG COLOR_BLUE
+
+#define MENU_COLOR_SELECT_FG COLOR_WHITE
+#define MENU_COLOR_SELECT_BG COLOR_RED
+
+#define MENU_COLOR_SEPARATOR_FG COLOR_CYAN
+#define MENU_COLOR_SEPARATOR_BG COLOR_BLUE
+
+#define MENU_COLOR_EDIT_FG COLOR_BLACK
+#define MENU_COLOR_EDIT_BG COLOR_CYAN
+
+#define MENU_COLOR_ALERT_FG COLOR_WHITE
+#define MENU_COLOR_ALERT_BG COLOR_RED
+
+#define MENU_COLOR_URL_FG COLOR_CYAN
+#define MENU_COLOR_URL_BG COLOR_BLUE
+
+#define MENU_COLOR_LABEL_FG COLOR_WHITE
+#define MENU_COLOR_LABEL_BG COLOR_BLACK
+
+#define MENU_COLOR_EDITBOX_FG COLOR_WHITE
+#define MENU_COLOR_EDITBOX_BG COLOR_BLUE
+
+#endif /* CONFIG_MENU_H */
diff --git a/src/hci/tui/login_ui.c b/src/hci/tui/login_ui.c
index 04aabfa..387855e 100644
--- a/src/hci/tui/login_ui.c
+++ b/src/hci/tui/login_ui.c
@@ -32,6 +32,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/editbox.h>
#include <ipxe/keys.h>
#include <ipxe/login_ui.h>
+#include <config/menu.h>
/* Colour pairs */
#define CPAIR_NORMAL 1
@@ -65,9 +66,9 @@ int login_ui ( void ) {
/* Initialise UI */
initscr();
start_color();
- init_pair ( CPAIR_NORMAL, COLOR_WHITE, COLOR_BLACK );
- init_pair ( CPAIR_LABEL, COLOR_WHITE, COLOR_BLACK );
- init_pair ( CPAIR_EDITBOX, COLOR_WHITE, COLOR_BLUE );
+ init_pair ( CPAIR_NORMAL, MENU_COLOR_NORMAL_FG, MENU_COLOR_NORMAL_BG );
+ init_pair ( CPAIR_LABEL, MENU_COLOR_LABEL_FG, MENU_COLOR_LABEL_BG );
+ init_pair ( CPAIR_EDITBOX, MENU_COLOR_EDITBOX_FG, MENU_COLOR_EDITBOX_BG );
init_editbox ( &username_box, username, sizeof ( username ), NULL,
USERNAME_ROW, EDITBOX_COL, EDITBOX_WIDTH, 0 );
init_editbox ( &password_box, password, sizeof ( password ), NULL,
diff --git a/src/hci/tui/menu_ui.c b/src/hci/tui/menu_ui.c
index 30d93ad..e3b9547 100644
--- a/src/hci/tui/menu_ui.c
+++ b/src/hci/tui/menu_ui.c
@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/timer.h>
#include <ipxe/console.h>
#include <ipxe/menu.h>
+#include <config/menu.h>
/* Colour pairs */
#define CPAIR_NORMAL 1
@@ -339,9 +340,9 @@ int show_menu ( struct menu *menu, unsigned int timeout_ms,
/* Initialise screen */
initscr();
start_color();
- init_pair ( CPAIR_NORMAL, COLOR_WHITE, COLOR_BLUE );
- init_pair ( CPAIR_SELECT, COLOR_WHITE, COLOR_RED );
- init_pair ( CPAIR_SEPARATOR, COLOR_CYAN, COLOR_BLUE );
+ init_pair ( CPAIR_NORMAL, MENU_COLOR_NORMAL_FG, MENU_COLOR_NORMAL_BG );
+ init_pair ( CPAIR_SELECT, MENU_COLOR_SELECT_FG, MENU_COLOR_SELECT_BG );
+ init_pair ( CPAIR_SEPARATOR, MENU_COLOR_SEPARATOR_FG, MENU_COLOR_SEPARATOR_BG );
color_set ( CPAIR_NORMAL, NULL );
erase();
diff --git a/src/hci/tui/settings_ui.c b/src/hci/tui/settings_ui.c
index ed07610..223379f 100644
--- a/src/hci/tui/settings_ui.c
+++ b/src/hci/tui/settings_ui.c
@@ -28,6 +28,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/editbox.h>
#include <ipxe/keys.h>
#include <ipxe/settings_ui.h>
+#include <config/menu.h>
/** @file
*
@@ -557,11 +558,11 @@ int settings_ui ( struct settings *settings ) {
initscr();
start_color();
- init_pair ( CPAIR_NORMAL, COLOR_WHITE, COLOR_BLUE );
- init_pair ( CPAIR_SELECT, COLOR_WHITE, COLOR_RED );
- init_pair ( CPAIR_EDIT, COLOR_BLACK, COLOR_CYAN );
- init_pair ( CPAIR_ALERT, COLOR_WHITE, COLOR_RED );
- init_pair ( CPAIR_URL, COLOR_CYAN, COLOR_BLUE );
+ init_pair ( CPAIR_NORMAL, MENU_COLOR_NORMAL_FG, MENU_COLOR_NORMAL_BG );
+ init_pair ( CPAIR_SELECT, MENU_COLOR_SELECT_FG, MENU_COLOR_SELECT_BG );
+ init_pair ( CPAIR_EDIT, MENU_COLOR_EDIT_FG, MENU_COLOR_EDIT_BG );
+ init_pair ( CPAIR_ALERT, MENU_COLOR_ALERT_FG, MENU_COLOR_ALERT_BG );
+ init_pair ( CPAIR_URL, MENU_COLOR_URL_FG, MENU_COLOR_URL_BG );
color_set ( CPAIR_NORMAL, NULL );
erase();
_______________________________________________
ipxe-devel mailing list
[email protected]
https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel