color.lua —
bootloader color module
color.lua contains functionality for
working with colors.
Before using the functionality provided by
color.lua, it must be included with a statement such
as the following:
local color =
require("color")
The following color constants are exported from
color.lua:
The following attribute constants are exported from
color.lua:
The following functions are exported from
color.lua:
color.isEnabled()
- Returns True if
loader(8)
has been configured to not allow color, False otherwise. This checks the
loader_color
loader.conf(5)
variable, along with
core.isSerialBoot().
color.escapefg(color_value)
- Returns the escape sequence that encodes color_value
as a foreground color.
color.escapefg() returns an
empty string if color is disabled.
color.resetfg()
- Returns the escape sequence for the default foreground color.
color.resetfg() returns an empty string if color
is disabled.
color.escapebg(color_value)
- Returns the escape sequence that encodes color_value
as a background color.
color.escapebg() returns an
empty string if color is disabled.
color.resetbg()
- Returns the escape sequence for the default background color.
color.resetbg() returns an empty string if color
is disabled.
color.escape(fg_color,
bg_color, attribute)
- Returns an escape sequence that encodes fg_color as
the foreground color, bg_color as the background
color, and attribute applied.
color.escape() returns an empty string if color is
disabled.
color.default()
- Returns the escape sequence for the default color scheme, white on black
with no attributes applied.
color.default()
returns an empty string if color is disabled.
color.highlight(str)
- Returns str with the
color.BRIGHT attribute applied before it and reset
after it. color.highlight() returns
str if color is disabled.