Skip to content

timob/go-colortext

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-colortext package GoSearch

This is a package to change the color of the text and background in the console, working both under Windows and other systems.

Under Windows, the console APIs are used. Otherwise, ANSI texts are output.

Docs: http://godoc.org/github.com/daviddengcn/go-colortext (packages that import ct)

Usage:

ct.Foreground(Green, false)
fmt.Println("Green text starts here...")
ct.ChangeColor(Red, true, White, false)
fmt.Println(...)
ct.ResetColor()

To write to a file:

colorFile, err := os.Create("colors.asc")
ct.Writer = colorFile
ct.Foreground(Red, false)
fmt.Fprint(colorFile, "R")
ct.Foreground(Green, false)
fmt.Fprint(colorFile, "G")
ct.Foreground(Blue, false)
fmt.Fprint(colorFile, "B")
ct.ResetColor()

LICENSE

BSD/MIT license

About

Change the color of console text.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%