Skip to main content

transform

Text transformation library for generating colored console output

Status

Stable: Functionality is covered by semantic versioning guarantees and unlikely to see breaking changes

Availability

This module is preloaded. You can simply require it:

local transform = require("transform")

Functions

black

Returns the input string wrapped in ANSI escape sequences so that it is rendered black in supporting terminals.

blackBackground

Returns the input string wrapped in ANSI escape sequences so that it is rendered on a black background in supporting terminals.

bold

Returns the input string wrapped in ANSI escape sequences so that it is rendered with bold font in supporting terminals.

brightRed

Returns the input string wrapped in ANSI escape sequences so that it is rendered bright red in supporting terminals.

brightRedBackground

Returns the input string wrapped in ANSI escape sequences so that it is rendered on a bright red background in supporting terminals.

cyan

Returns the input string wrapped in ANSI escape sequences so that it is rendered cyan in supporting terminals.

enable

Globally enables text transformations. This operation is not applied retroactively. Text transformations are enabled by default.

disable

Globally disables text transformations. This operation is not applied retroactively. Use this if your terminal can't display colors.

gray

Returns the input string wrapped in ANSI escape sequences so that it is rendered gray in supporting terminals.

green

Returns the input string wrapped in ANSI escape sequences so that it is rendered green in supporting terminals.

greenBackground

Returns the input string wrapped in ANSI escape sequences so that it is rendered on a green background in supporting terminals.

red

Returns the input string wrapped in ANSI escape sequences so that it is rendered dark red in supporting terminals.

underline

Returns the input string wrapped in ANSI escape sequences so that it is rendered underlined in supporting terminals.

yellow

Returns the input string wrapped in ANSI escape sequences so that it is rendered yellow in supporting terminals.

white

Returns the input string wrapped in ANSI escape sequences so that it is rendered white in supporting terminals.

whiteBackground

Returns the input string wrapped in ANSI escape sequences so that it is rendered on a white background in supporting terminals.

Changelog

VersionWhat happened?
v0.0.1Initial release