DOKK / manpages / debian 12 / libbash / colors.3.en
COLORS(3) 3 (libbash colors library manual) COLORS(3)

colorslibbash library for setting tty colors.

color
 
[⟨indent⟩] ⟨color⟩ ⟨text
[⟨indent⟩] ⟨color⟩ ⟨text

colors is a collection of functions that make it very easy to put colored text on tty.

The function list:

Sets the color of the prints to the tty to COLOR
Resets current tty color back to normal
Prints TEXT in the color COLOR indented by INDENT (without adding a newline)
The same as colorPrint, but trailing newline is added

Detailed interface description follows.

 
 
 
 

The color parameter is non-case-sensitive (i.e. RED, red, ReD, and all the other forms are valid and are the same as Red).

Sets the current printing color to color.

colorReset

Resets current tty color back to normal.

Prints using the color color indented by (without adding a newline).

Parameters:

indent
The column to move to before start printing. This parameter is optional. If ommitted - start output from current cursor position.
color
The color to use.
color
The text to print.

The same as colorPrint, except a trailing newline is added.

Printing a green 'Hello World' with a newline:

Using colorSet:
$ colorSet green
$ echo 'Hello World'
$ colorReset
Using colorPrint:
$ colorPrint 'Hello World'; echo
Using colorPrintN:
$ colorPrintN 'Hello World'

Hai Zaar ⟨haizaar@haizaar.com⟩
Gil Ran ⟨gil@ran4.net⟩

ldbash(1), libbash(1)

Linux