Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 630 Bytes

README.md

File metadata and controls

30 lines (22 loc) · 630 Bytes

golor

golor is a terminal color package for Go, supporting both 16-colors mode and 256 colors mode.

Example usage

16-bit color printing:

// See examples/colors.go
fmt.Println(golor.Colorize("Green foreground", golor.G, -1))
fmt.Println(golor.Colorize("Cyan background", -1, golor.CYAN))

256-color printing:

// See examples/colors.go
index := 42  // index can vary from 0 to 255
fmt.Println(golor.Colorize("Foreground", index, -1))

Consistently assigning unique colors to strings:

// See examples/unique.go
name := "srid"
fmt.Println(golor.Colorize(process, golor.AssignColor(name), -1))