---
name: "colors"
section: "3"
platform: "linux"
package: "libbash"
version: "0.9.11-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/colors"
---

# colors(3)

libbash library for setting tty colors.

## NAME

**colors** – libbash library for setting tty colors.

## SYNOPSIS

- **colorSet**

  ⟨*color*⟩

- **colorReset**

  - **colorPrint**

  \[⟨indent⟩\] ⟨*color*⟩ ⟨*text*⟩

- **colorPrintN**

  \[⟨indent⟩\] ⟨*color*⟩ ⟨*text*⟩

## DESCRIPTION

### General

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

The function list:

- **colorSet**

  Sets the color of the prints to the tty to COLOR

- **colorReset**

  Resets current tty color back to normal

- **colorPrint**

  Prints TEXT in the color COLOR indented by INDENT (without adding a newline)

- **colorPrintN**

  The same as colorPrint, but trailing newline is added

Detailed interface description follows.

### Available colors:

- **Green**

  - **Red**

  - **Yellow**

  - **White**

  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).

## FUNCTIONS DESCRIPTIONS

### Cm colorSet Aq Ns Fa color Ns

Sets the current printing color to  *color*.

### Cm colorReset

Resets current tty color back to normal.

### Cm colorPrint Bo Ao Ns Fa indent Ns Ac Bc Aq Ns Fa color Ns

Prints  *text* using the color  *color* indented by  *indent* (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.

### Cm colorPrintN Bo Ao Ns Fa indent Ns Ac Bc Aq Ns Fa color Ns

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

## EXAMPLES

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'

## AUTHORS

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

## SEE ALSO

[ldbash(1)](/ldbash/1.md), libbash(1)
