Browse Source

[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 12 years ago
parent
commit
512ed2b921
4 changed files with 45 additions and 10 deletions
  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 View File

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 View File

32
 #include <ipxe/editbox.h>
32
 #include <ipxe/editbox.h>
33
 #include <ipxe/keys.h>
33
 #include <ipxe/keys.h>
34
 #include <ipxe/login_ui.h>
34
 #include <ipxe/login_ui.h>
35
+#include <config/colour.h>
35
 
36
 
36
 /* Colour pairs */
37
 /* Colour pairs */
37
 #define CPAIR_NORMAL		1
38
 #define CPAIR_NORMAL		1
64
 	/* Initialise UI */
65
 	/* Initialise UI */
65
 	initscr();
66
 	initscr();
66
 	start_color();
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
 	init_editbox ( &username_box, username, sizeof ( username ), NULL,
70
 	init_editbox ( &username_box, username, sizeof ( username ), NULL,
70
 		       USERNAME_ROW, EDITBOX_COL, EDITBOX_WIDTH, 0 );
71
 		       USERNAME_ROW, EDITBOX_COL, EDITBOX_WIDTH, 0 );
71
 	init_editbox ( &password_box, password, sizeof ( password ), NULL,
72
 	init_editbox ( &password_box, password, sizeof ( password ), NULL,

+ 4
- 3
src/hci/tui/menu_ui.c View File

31
 #include <ipxe/timer.h>
31
 #include <ipxe/timer.h>
32
 #include <ipxe/console.h>
32
 #include <ipxe/console.h>
33
 #include <ipxe/menu.h>
33
 #include <ipxe/menu.h>
34
+#include <config/colour.h>
34
 
35
 
35
 /* Colour pairs */
36
 /* Colour pairs */
36
 #define CPAIR_NORMAL	1
37
 #define CPAIR_NORMAL	1
339
 	/* Initialise screen */
340
 	/* Initialise screen */
340
 	initscr();
341
 	initscr();
341
 	start_color();
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
 	color_set ( CPAIR_NORMAL, NULL );
346
 	color_set ( CPAIR_NORMAL, NULL );
346
 	erase();
347
 	erase();
347
 
348
 

+ 6
- 5
src/hci/tui/settings_ui.c View File

28
 #include <ipxe/editbox.h>
28
 #include <ipxe/editbox.h>
29
 #include <ipxe/keys.h>
29
 #include <ipxe/keys.h>
30
 #include <ipxe/settings_ui.h>
30
 #include <ipxe/settings_ui.h>
31
+#include <config/colour.h>
31
 
32
 
32
 /** @file
33
 /** @file
33
  *
34
  *
557
 
558
 
558
 	initscr();
559
 	initscr();
559
 	start_color();
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
 	color_set ( CPAIR_NORMAL, NULL );
566
 	color_set ( CPAIR_NORMAL, NULL );
566
 	erase();
567
 	erase();
567
 	
568
 	

Loading…
Cancel
Save