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.

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
coloredTextstring

blackBackground​

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

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
coloredTextstring

bold​

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

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
transformedTextstring

brightRed​

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

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
coloredTextstring

brightRedBackground​

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

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
coloredTextstring

cyan​

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

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
coloredTextstring

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.

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
coloredTextstring

green​

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

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
coloredTextstring

greenBackground​

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

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
coloredTextstring

red​

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

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
coloredTextstring

underline​

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

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
transformedTextstring

yellow​

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

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
coloredTextstring

white​

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

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
coloredTextstring

whiteBackground​

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

Available since: v0.0.1
Arguments
#NameTypeFallback
textstring
Return values
#NameType
coloredTextstring

Changelog​

VersionWhat happened?
v0.0.1Initial release