Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
.travis.yml | H A D | 24-May-2016 | 61 | |||
COPYING | H A D | 24-May-2016 | 1.1 KiB | |||
README.md | H A D | 24-May-2016 | 1.4 KiB | |||
colour.go | H A D | 24-May-2016 | 6.1 KiB | |||
colour_test.go | H A D | 24-May-2016 | 1.9 KiB |
README.md
1# Colour terminal text for Go (Golang) [![](https://godoc.org/github.com/alecthomas/colour?status.svg)](http://godoc.org/github.com/alecthomas/colour) [![Build Status](https://travis-ci.org/alecthomas/colour.png)](https://travis-ci.org/alecthomas/colour) 2 3Package colour provides [Quake-style colour formatting][2] for Unix terminals. 4 5The package level functions can be used to write to stdout (or strings or 6other files). If stdout is not a terminal, colour formatting will be 7stripped. 8 9eg. 10 11 colour.Printf("^0black ^1red ^2green ^3yellow ^4blue ^5magenta ^6cyan ^7white^R\n") 12 13 14For more control a Printer object can be created with various helper 15functions. This can be used to do useful things such as strip formatting, 16write to strings, and so on. 17 18The following sequences are converted to their equivalent ANSI colours: 19 20| Sequence | Effect | 21| -------- | ------ | 22| ^0 | Black | 23| ^1 | Red | 24| ^2 | Green | 25| ^3 | Yellow | 26| ^4 | Blue | 27| ^5 | Cyan (light blue) | 28| ^6 | Magenta (purple) | 29| ^7 | White | 30| ^8 | Black Background | 31| ^9 | Red Background | 32| ^a | Green Background | 33| ^b | Yellow Background | 34| ^c | Blue Background | 35| ^d | Cyan (light blue) Background | 36| ^e | Magenta (purple) Background | 37| ^f | White Background | 38| ^R | Reset | 39| ^U | Underline | 40| ^D | Dim | 41| ^B | Bold | 42 43[1]: http://godoc.org/github.com/alecthomas/colour 44[2]: http://www.holysh1t.net/quake-live-colors-nickname/ 45