From 85efc91a3c81b448a5d01bbd24faa17215568d35 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Mon, 19 Mar 2018 15:48:31 +0000 Subject: [PATCH] lualoader: Setup default color scheme if we're using colors The console may have been set for different colors before lualoader kicks in; notably, a black-on-white color scheme is not necessarily what we're expecting. While here, make color.default() a composition of color.escape() instead of rewriting the escape sequence to make it more obvious what it's achieving: a white-on-black color scheme with no attributes set. Reported by: emaste, whose eyes may rest easily --- stand/lua/color.lua | 2 +- stand/lua/loader.lua | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/stand/lua/color.lua b/stand/lua/color.lua index 5dcc7e675a44..532482c6804d 100644 --- a/stand/lua/color.lua +++ b/stand/lua/color.lua @@ -89,7 +89,7 @@ function color.default() if color.disabled then return "" end - return core.KEYSTR_CSI .. "0;37;40m" + return color.escape(color.WHITE, color.BLACK, color.DEFAULT) end function color.highlight(str) diff --git a/stand/lua/loader.lua b/stand/lua/loader.lua index 863f7613b3da..b406ba4969e9 100644 --- a/stand/lua/loader.lua +++ b/stand/lua/loader.lua @@ -34,6 +34,7 @@ -- Other modules will also need some of the functions it defines to safely -- execute loader commands. require("cli") +local color = require("color") local core = require("core") local config = require("config") local menu @@ -49,6 +50,11 @@ if result ~= nil then end config.load() +-- Our console may have been setup for a different color scheme before we get +-- here, so make sure we set the default. +if color.isEnabled() then + printc(color.default()) +end password.check() -- menu might be disabled if menu ~= nil then