---
name: "color.lua"
section: "8"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/color.lua"
---

# color.lua(8)

bootloader color module

## NAME

**color.lua** – bootloader color module

## DESCRIPTION

**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**:

- **color.BLACK**

  - **color.RED**

  - **color.GREEN**

  - **color.YELLOW**

  - **color.BLUE**

  - **color.MAGENTA**

  - **color.CYAN**

  - **color.WHITE**

  The following attribute constants are exported from **color.lua**:

- **color.DEFAULT**

  - **color.BRIGHT**

  - **color.DIM**

  The following functions are exported from **color.lua**:

- **color.isEnabled**()

  Returns True if [loader(8)](/loader/8.md) has been configured to not allow color, False otherwise. This checks the loader\_color [loader.conf(5)](/loader.conf/5.md) 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.

## SEE ALSO

[screen.lua(8)](/screen.lua/8.md)

## 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*⟩.
