

Colors - #golang #color_text_on_terminal #colorful_output #golang_package
source link: https://www.tuicool.com/articles/hit/26FJ7fM
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Colors
A small golang utility to print colorful output on terminal
Installation
import color "github.com/amulyakashyap09/colors"
Usage
var message string = "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..." #bgColor, fgColor, message color.Custom("black", "yellow", message)
Documentation
color.Custom(bgColor, fgColor, message)
| color.Custom
will print the message
in colors provided as input
color.Error(message)
| color.Error
will print the error
in red & bold
color.Panic(message)
| color.Panic
will print the error
in red & bold & will exit
the process
color.Success(message)
| color.Success
will print the message
in green
color.Info(message)
| color.Info
will print the message
in blue
color.Warn(message)
| color.Warn
will print the message
in yellow
color.Yellow(message)
| color.Yellow
will print the message
in yellow
color.Blue(message)
| color.Blue
will print the message
in blue
color.Green(message)
| color.Green
will print the message
in green
color.Red(message)
| color.Red
will print the message
in red
color.Magenta(message)
| color.Magenta
will print the message
in magenta
color.Cyan(message)
| color.Cyan
will print the message
in cyan
color.White(message)
| color.White
will print the message
in white
color.Black(message)
| color.Black
will print the message
in black
Author
Amulya Kashyap [email protected] 9559974779
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK