Skip to content

Latest commit

 

History

History
41 lines (25 loc) · 839 Bytes

README.md

File metadata and controls

41 lines (25 loc) · 839 Bytes

go-color

go-color is a simple color library for Go that allows you to print colored text for the Unix terminal.

Installation

go install github.com/ermanimer/go-color@latest

Usage

// use predefined colors
color.Red.Println("red text")

// create colors with color codes, see the color chart below.
color.New(240).Println("gray text")

// add background color
color.New(220).With(color.Blue).Println("orange text on a blue background")

// create colored strings
fmt.Printf("%s %s\n", color.Green.Paint("green text"), color.Yellow.Paint("with yellow text"))

Output

output

Color Codes:

color_codes

Contribution

Your contribution and feedback are always welcome.

References

ANSI Escape Code