Module lua-color.terminal
Style terminal output
Standard colors:
- black
- red
- green
- yellow
- blue
- pink
- cyan
- white
- default
! Not all terminals support all effects
! Generally you can expect the colors from the list above
to work on all *nix systems
More information
Functions
set (options) | Set a format. |
reset () | Reset the format. |
apply (options) | Set a format for a string. |
Fields
Effect | Effect flags |
Functions
- set (options)
-
Set a format.
Options table:color
: Foreground colorbg
orbackground
: Background colorfont
: Number between 0 (default) and 9 to select font- An effect as
<effect_name> = true
- Flags for effects as index 1
Parameters:
Returns:
-
string
Escape sequence
Usage:
-- Blue, underlined and italic local tc = require "lua-color.terminal" print(tc.set { color = "blue", tc.Effect.underline | tc.Effect.italic, } .. "Hello world!" .. tc.reset())
-- Red background, font number 3 and underlined print(tc.set { bg = Color {1, 0, 0}, font = 3, underline = true, } .. "Hello world!" .. tc.reset())
- reset ()
-
Reset the format.
Returns:
-
string
Escape sequence
- apply (options)
-
Set a format for a string.
Sets the format before the string and resets it after.
Parameters:
Returns:
-
string
Escape sequence
Usage:
-- Red on green background local tc = require "lua-color.terminal" print(tc.apply { color = "red", bg = "green", to = "Hello world!", })