menu: Add option to change the colour of the branding string
diff --git a/CONFIG.md b/CONFIG.md
index 7c34ca85..b292ca7a 100644
--- a/CONFIG.md
+++ b/CONFIG.md
@@ -56,6 +56,8 @@ Some keys take *URIs* as values; these are described in the next section.
* `GRAPHICS` - If set to `yes`, use a graphical framebuffer for the boot menu, else use text mode. Ignored with Limine UEFI, forced to `yes`.
* `MENU_RESOLUTION` - Specify screen resolution to be used by the Limine menu in the form `<width>x<height>`. This will *only* affect the menu, not any booted OS. If not specified, Limine will pick a resolution automatically. If the resolution is not available, Limine will pick another one automatically. Ignored if `GRAPHICS` is not `yes`.
* `MENU_BRANDING` - A string that will be displayed on top of the Limine menu.
+* `MENU_BRANDING_COLOUR` - A value between 0 and 7 specifying the colour of the branding string. Default is cyan (6).
+* `MENU_BRANDING_COLOR` - Alias of `MENU_BRANDING_COLOUR`.
* `MENU_FONT` - URI path to a font file to be used instead of the default one for the menu and terminal. The font file must be a code page 437 character set comprised of 256 consecutive glyph bitmaps. Each glyph's bitmap must be expressed left to right (1 byte per row), and top to bottom (16 bytes per whole glyph by default; see `MENU_FONT_SIZE`). See e.g. the [VGA text mode font collection](https://github.com/viler-int10h/vga-text-mode-fonts) for fonts.
* `TERMINAL_FONT` - Alias of `MENU_FONT`.
* `MENU_FONT_SIZE` - The size of the font in dots, which must correspond to the font file or the display will be garbled. Note that glyphs are always one byte wide, and columns over 8 are empty. Many fonts may be used in both 8- and 9-dot wide variants. Defaults to `8x16`. Ignored if `MENU_FONT` or `TERMINAL_FONT` not set or if the font fails to load.
diff --git a/stage23/menu.c b/stage23/menu.c
index 9e5c5efb..3f6c53bc 100644
--- a/stage23/menu.c
+++ b/stage23/menu.c
@@ -14,6 +14,7 @@
#include <drivers/vbe.h>
static char *menu_branding = NULL;
+static char *menu_branding_colour = NULL;
#define EDITOR_MAX_BUFFER_SIZE 4096
#define TOK_KEY 0
@@ -78,6 +79,8 @@ static const char *VALID_KEYS[] = {
"GRAPHICS",
"MENU_RESOLUTION",
"MENU_BRANDING",
+ "MENU_BRANDING_COLOUR",
+ "MENU_BRANDING_COLOR",
"MENU_FONT",
"MENU_FONT_SIZE",
"MENU_FONT_SCALE",
@@ -191,7 +194,7 @@ refresh:
print("\n");
get_cursor_pos(&x, &y);
set_cursor_pos(term_cols / 2 - DIV_ROUNDUP(strlen(menu_branding), 2), y);
- print("\e[36m%s\e[37m", menu_branding);
+ print("\e[3%sm%s\e[37m", menu_branding_colour, menu_branding);
print("\n\n");
}
@@ -490,6 +493,12 @@ char *menu(char **cmdline) {
if (menu_branding == NULL)
menu_branding = "Limine " LIMINE_VERSION;
+ menu_branding_colour = config_get_value(NULL, 0, "MENU_BRANDING_COLOUR");
+ if (menu_branding_colour == NULL)
+ menu_branding_colour = config_get_value(NULL, 0, "MENU_BRANDING_COLOR");
+ if (menu_branding_colour == NULL)
+ menu_branding_colour = "6";
+
bool skip_timeout = false;
struct menu_entry *selected_menu_entry = NULL;
@@ -555,7 +564,7 @@ refresh:
print("\n");
get_cursor_pos(&x, &y);
set_cursor_pos(term_cols / 2 - DIV_ROUNDUP(strlen(menu_branding), 2), y);
- print("\e[36m%s\e[37m", menu_branding);
+ print("\e[3%sm%s\e[37m", menu_branding_colour, menu_branding);
print("\n\n\n\n");
}
