Quellcode durchsuchen

[ui] Allow colours to be configured via config/colour.h

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Christian Hesse vor 12 Jahren
Ursprung
Commit
512ed2b921
4 geänderte Dateien mit 45 neuen und 10 gelöschten Zeilen
  1. 32
    0
      src/config/colour.h
  2. 3
    2
      src/hci/tui/login_ui.c
  3. 4
    3
      src/hci/tui/menu_ui.c
  4. 6
    5
      src/hci/tui/settings_ui.c

+ 32
- 0
src/config/colour.h Datei anzeigen

@@ -0,0 +1,32 @@
1
+#ifndef CONFIG_COLOUR_H
2
+#define CONFIG_COLOUR_H
3
+
4
+/** @file
5
+ *
6
+ * Display colour configuration
7
+ *
8
+ */
9
+
10
+FILE_LICENCE ( GPL2_OR_LATER );
11
+
12
+#define COLOR_NORMAL_FG		COLOR_WHITE
13
+#define COLOR_NORMAL_BG		COLOR_BLUE
14
+
15
+#define COLOR_SELECT_FG		COLOR_WHITE
16
+#define COLOR_SELECT_BG		COLOR_RED
17
+
18
+#define COLOR_SEPARATOR_FG	COLOR_CYAN
19
+#define COLOR_SEPARATOR_BG	COLOR_BLUE
20
+
21
+#define COLOR_EDIT_FG		COLOR_BLACK
22
+#define COLOR_EDIT_BG		COLOR_CYAN
23
+
24
+#define COLOR_ALERT_FG		COLOR_WHITE
25
+#define COLOR_ALERT_BG		COLOR_RED
26
+
27
+#define COLOR_URL_FG		COLOR_CYAN
28
+#define COLOR_URL_BG		COLOR_BLUE
29
+
30
+#include <config/local/colour.h>
31
+
32
+#endif /* CONFIG_COLOUR_H */

+ 3
- 2
src/hci/tui/login_ui.c Datei anzeigen

@@ -32,6 +32,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
32 32
 #include <ipxe/editbox.h>
33 33
 #include <ipxe/keys.h>
34 34
 #include <ipxe/login_ui.h>
35
+#include <config/colour.h>
35 36
 
36 37
 /* Colour pairs */
37 38
 #define CPAIR_NORMAL		1
@@ -64,8 +65,8 @@ int login_ui ( void ) {
64 65
 	/* Initialise UI */
65 66
 	initscr();
66 67
 	start_color();
67
-	init_pair ( CPAIR_NORMAL, COLOR_WHITE, COLOR_BLUE );
68
-	init_pair ( CPAIR_EDIT, COLOR_BLACK, COLOR_CYAN );
68
+	init_pair ( CPAIR_NORMAL, COLOR_NORMAL_FG, COLOR_NORMAL_BG );
69
+	init_pair ( CPAIR_EDIT, COLOR_EDIT_FG, COLOR_EDIT_BG );
69 70
 	init_editbox ( &username_box, username, sizeof ( username ), NULL,
70 71
 		       USERNAME_ROW, EDITBOX_COL, EDITBOX_WIDTH, 0 );
71 72
 	init_editbox ( &password_box, password, sizeof ( password ), NULL,

+ 4
- 3
src/hci/tui/menu_ui.c Datei anzeigen

@@ -31,6 +31,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
31 31
 #include <ipxe/timer.h>
32 32
 #include <ipxe/console.h>
33 33
 #include <ipxe/menu.h>
34
+#include <config/colour.h>
34 35
 
35 36
 /* Colour pairs */
36 37
 #define CPAIR_NORMAL	1
@@ -339,9 +340,9 @@ int show_menu ( struct menu *menu, unsigned int timeout_ms,
339 340
 	/* Initialise screen */
340 341
 	initscr();
341 342
 	start_color();
342
-	init_pair ( CPAIR_NORMAL, COLOR_WHITE, COLOR_BLUE );
343
-	init_pair ( CPAIR_SELECT, COLOR_WHITE, COLOR_RED );
344
-	init_pair ( CPAIR_SEPARATOR, COLOR_CYAN, COLOR_BLUE );
343
+	init_pair ( CPAIR_NORMAL, COLOR_NORMAL_FG, COLOR_NORMAL_BG );
344
+	init_pair ( CPAIR_SELECT, COLOR_SELECT_FG, COLOR_SELECT_BG );
345
+	init_pair ( CPAIR_SEPARATOR, COLOR_SEPARATOR_FG, COLOR_SEPARATOR_BG );
345 346
 	color_set ( CPAIR_NORMAL, NULL );
346 347
 	erase();
347 348
 

+ 6
- 5
src/hci/tui/settings_ui.c Datei anzeigen

@@ -28,6 +28,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
28 28
 #include <ipxe/editbox.h>
29 29
 #include <ipxe/keys.h>
30 30
 #include <ipxe/settings_ui.h>
31
+#include <config/colour.h>
31 32
 
32 33
 /** @file
33 34
  *
@@ -557,11 +558,11 @@ int settings_ui ( struct settings *settings ) {
557 558
 
558 559
 	initscr();
559 560
 	start_color();
560
-	init_pair ( CPAIR_NORMAL, COLOR_WHITE, COLOR_BLUE );
561
-	init_pair ( CPAIR_SELECT, COLOR_WHITE, COLOR_RED );
562
-	init_pair ( CPAIR_EDIT, COLOR_BLACK, COLOR_CYAN );
563
-	init_pair ( CPAIR_ALERT, COLOR_WHITE, COLOR_RED );
564
-	init_pair ( CPAIR_URL, COLOR_CYAN, COLOR_BLUE );
561
+	init_pair ( CPAIR_NORMAL, COLOR_NORMAL_FG, COLOR_NORMAL_BG );
562
+	init_pair ( CPAIR_SELECT, COLOR_SELECT_FG, COLOR_SELECT_BG );
563
+	init_pair ( CPAIR_EDIT, COLOR_EDIT_FG, COLOR_EDIT_BG );
564
+	init_pair ( CPAIR_ALERT, COLOR_ALERT_FG, COLOR_ALERT_BG );
565
+	init_pair ( CPAIR_URL, COLOR_URL_FG, COLOR_URL_BG );
565 566
 	color_set ( CPAIR_NORMAL, NULL );
566 567
 	erase();
567 568
 	

Laden…
Abbrechen
Speichern