COLOR.LUA(8)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

✨ color.lua(8) ✨

ok so bestie, this is the man page for color.lua β€” straight out of the System Manager's Manual β€” and it's literally the bootloader color module. yes. colors. in your bootloader. we love to see it πŸ’…


πŸŽ€ NAME πŸŽ€

color.lua β€” the bootloader color module, aka the thing that makes your boot sequence not look like a sad gray void πŸ¦‹


🌈 DESCRIPTION 🌈

color.lua contains functionality for working with colors. that's it. that's the vibe. ✨

Before you can use any of the functionality provided by color.lua, it must be included with a statement such as the following:

local color = require("color")

no cap, you gotta do that first or nothing works. 🫢


πŸ’– Color Constants πŸ’–

The following color constants are exported from color.lua:

color.BLACK

color.RED

color.GREEN

color.YELLOW

color.BLUE

color.MAGENTA

color.CYAN

color.WHITE

the whole rainbow, iconic, no notes πŸŒˆπŸ‘‘


🌸 Attribute Constants 🌸

The following attribute constants are exported from color.lua:

color.DEFAULT

color.BRIGHT

color.DIM

three little vibes for your text. use them wisely. πŸ’…


🧚 Functions 🧚

The following functions are exported from color.lua β€” buckle up, there's a bunch:

  • color.isEnabled() β€” Returns True if loader(8) has been configured to not allow color, False otherwise. It checks the loader_color loader.conf(5) variable, along with core.isSerialBoot(). (yes, True means color is not allowed β€” that's what it says, don't come for me 😭)
  • 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.
πŸ’€ heads up: like, half of these return an empty string when color is disabled. that's not a bug, that's the whole point β€” every single one of the escape-sequence functions bails gracefully. color.highlight() is the odd one out and gives you back your str untouched instead.

πŸ¦‹ SEE ALSO πŸ¦‹


πŸ‘‘ AUTHORS πŸ‘‘

The color.lua file was originally written by Pedro Souza <pedrosouza@FreeBSD.org>. Later work and this manual page was done by Kyle Evans <kevans@FreeBSD.org>.


aaaand that's the whole thing, bestie 🫢 this page shipped with Debian, dated March 29, 2025 β€” go forth and color your bootloader, you absolute main character πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from