Skip to content

Pretty Printer package used for colorful console output support for Golang

License

Notifications You must be signed in to change notification settings

michalpristas/PrettyPrinter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PrettyPrinter

Pretty Printer package used for colorful console output support for Golang

Usage

Pretty Printer simpyfies writing colorful output to command line providing simple API which is more readable than:

	fmt.Printf("\x1b[47m\x1b[31;1mRed title: \x1b[0m%s: \n\x1b[32;1mBody: \x1b[0m%s\x1b[0m\n", "Sample title param", "Sample body param")

With this API you can do:

	fmt.Print(prettyPrinter.New().
		BgYellow().BoldRed("Red title: ").Text("%s: \n").
		BoldGreen("Body: ").Text("%s\n").
		Format("Sample title param", "Sample body param"))

Every text element (colorful or not) will reset background color

Sample above will have following output:

Alt text

About

Pretty Printer package used for colorful console output support for Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages