Categorygithub.com/alecthomas/colour
modulepackage
0.1.0
Repository: https://github.com/alecthomas/colour.git
Documentation: pkg.go.dev

# README

Colour terminal text for Go (Golang) Build Status

Package colour provides Quake-style colour formatting for Unix terminals.

The package level functions can be used to write to stdout (or strings or other files). If stdout is not a terminal, colour formatting will be stripped.

eg.

colour.Printf("^0black ^1red ^2green ^3yellow ^4blue ^5magenta ^6cyan ^7white^R\n")

For more control a Printer object can be created with various helper functions. This can be used to do useful things such as strip formatting, write to strings, and so on.

The following sequences are converted to their equivalent ANSI colours:

SequenceEffect
^0Black
^1Red
^2Green
^3Yellow
^4Blue
^5Cyan (light blue)
^6Magenta (purple)
^7White
^8Black Background
^9Red Background
^aGreen Background
^bYellow Background
^cBlue Background
^dCyan (light blue) Background
^eMagenta (purple) Background
^fWhite Background
^RReset
^UUnderline
^DDim
^BBold
^SStrikethrough

# Functions

Colour creats a new ANSI colour Printer on w.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
String creates a new Printer that writes ANSI coloured text to a buffer.
StringStripper writes text stripped of colour formatting codes to a string.
Strip returns a Printer that strips all colour codes from printed strings before writing to w.
No description provided by the author
TTY creates a Printer that colourises output if w is a terminal, or strips formatting if it is not.

# Variables

Stderr is an conditional colour writer for os.Stderr.
Stdout is an conditional colour writer for os.Stdout.

# Structs

No description provided by the author

# Interfaces

A Printer implements functions that accept Quake-style colour formatting and print coloured text.