lualoader: Clear up some possible naming confusion
In the original lualoader project, 'escapef' and 'escapeb' were chosen for 'escape fg' and 'escape bg'. We've carried on this naming convention, and as our use of attributes grow the likeliness of 'escapeb'/'resetb' being confused upon glance for 'escape bold'/'reset bold' increases. Fix this by renaming these four functions to {escape,reset}{fg,bg} rather than {escape,reset}{f,b} for clarity. Reported by: dteske
This commit is contained in:
parent
7961a77148
commit
8ce1744f82
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=331304
@ -58,28 +58,28 @@ end
|
|||||||
|
|
||||||
color.disabled = not color.isEnabled()
|
color.disabled = not color.isEnabled()
|
||||||
|
|
||||||
function color.escapef(color_value)
|
function color.escapefg(color_value)
|
||||||
if color.disabled then
|
if color.disabled then
|
||||||
return color_value
|
return color_value
|
||||||
end
|
end
|
||||||
return core.KEYSTR_CSI .. "3" .. color_value .. "m"
|
return core.KEYSTR_CSI .. "3" .. color_value .. "m"
|
||||||
end
|
end
|
||||||
|
|
||||||
function color.resetf()
|
function color.resetfg()
|
||||||
if color.disabled then
|
if color.disabled then
|
||||||
return ''
|
return ''
|
||||||
end
|
end
|
||||||
return core.KEYSTR_CSI .. "39m"
|
return core.KEYSTR_CSI .. "39m"
|
||||||
end
|
end
|
||||||
|
|
||||||
function color.escapeb(color_value)
|
function color.escapebg(color_value)
|
||||||
if color.disabled then
|
if color.disabled then
|
||||||
return color_value
|
return color_value
|
||||||
end
|
end
|
||||||
return core.KEYSTR_CSI .. "4" .. color_value .. "m"
|
return core.KEYSTR_CSI .. "4" .. color_value .. "m"
|
||||||
end
|
end
|
||||||
|
|
||||||
function color.resetb()
|
function color.resetbg()
|
||||||
if color.disabled then
|
if color.disabled then
|
||||||
return ''
|
return ''
|
||||||
end
|
end
|
||||||
|
@ -46,11 +46,11 @@ local return_menu_entry = {
|
|||||||
|
|
||||||
local function OnOff(str, value)
|
local function OnOff(str, value)
|
||||||
if value then
|
if value then
|
||||||
return str .. color.escapef(color.GREEN) .. "On" ..
|
return str .. color.escapefg(color.GREEN) .. "On" ..
|
||||||
color.escapef(color.WHITE)
|
color.escapefg(color.WHITE)
|
||||||
else
|
else
|
||||||
return str .. color.escapef(color.RED) .. "off" ..
|
return str .. color.escapefg(color.RED) .. "off" ..
|
||||||
color.escapef(color.WHITE)
|
color.escapefg(color.WHITE)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -115,12 +115,12 @@ menu.boot_environments = {
|
|||||||
local bootenv_name = ""
|
local bootenv_name = ""
|
||||||
local name_color
|
local name_color
|
||||||
if is_default then
|
if is_default then
|
||||||
name_color = color.escapef(color.GREEN)
|
name_color = color.escapefg(color.GREEN)
|
||||||
else
|
else
|
||||||
name_color = color.escapef(color.BLUE)
|
name_color = color.escapefg(color.BLUE)
|
||||||
end
|
end
|
||||||
bootenv_name = bootenv_name .. name_color ..
|
bootenv_name = bootenv_name .. name_color ..
|
||||||
choice .. color.resetf()
|
choice .. color.resetfg()
|
||||||
return color.highlight("A").."ctive: " ..
|
return color.highlight("A").."ctive: " ..
|
||||||
bootenv_name .. " (" .. idx .. " of " ..
|
bootenv_name .. " (" .. idx .. " of " ..
|
||||||
#all_choices .. ")"
|
#all_choices .. ")"
|
||||||
@ -300,13 +300,13 @@ menu.welcome = {
|
|||||||
local kernel_name = ""
|
local kernel_name = ""
|
||||||
local name_color
|
local name_color
|
||||||
if is_default then
|
if is_default then
|
||||||
name_color = color.escapef(color.GREEN)
|
name_color = color.escapefg(color.GREEN)
|
||||||
kernel_name = "default/"
|
kernel_name = "default/"
|
||||||
else
|
else
|
||||||
name_color = color.escapef(color.BLUE)
|
name_color = color.escapefg(color.BLUE)
|
||||||
end
|
end
|
||||||
kernel_name = kernel_name .. name_color ..
|
kernel_name = kernel_name .. name_color ..
|
||||||
choice .. color.resetf()
|
choice .. color.resetfg()
|
||||||
return color.highlight("K") .. "ernel: " ..
|
return color.highlight("K") .. "ernel: " ..
|
||||||
kernel_name .. " (" .. idx .. " of " ..
|
kernel_name .. " (" .. idx .. " of " ..
|
||||||
#all_choices .. ")"
|
#all_choices .. ")"
|
||||||
|
@ -56,14 +56,14 @@ function screen.setforeground(color_value)
|
|||||||
if color.disabled then
|
if color.disabled then
|
||||||
return color_value
|
return color_value
|
||||||
end
|
end
|
||||||
printc(color.escapef(color_value))
|
printc(color.escapefg(color_value))
|
||||||
end
|
end
|
||||||
|
|
||||||
function screen.setbackground(color_value)
|
function screen.setbackground(color_value)
|
||||||
if color.disabled then
|
if color.disabled then
|
||||||
return color_value
|
return color_value
|
||||||
end
|
end
|
||||||
printc(color.escapeb(color_value))
|
printc(color.escapebg(color_value))
|
||||||
end
|
end
|
||||||
|
|
||||||
function screen.defcolor()
|
function screen.defcolor()
|
||||||
|
Loading…
Reference in New Issue
Block a user