How to Add Color Output to a Go CLI

Cli
Add color output to a Go CLI by installing the fatih/color library and wrapping print statements with color functions.

Use the github.com/fatih/color library to wrap standard output with ANSI color codes. Install the package and apply color functions like color.Red or color.Blue to your print statements.

go get github.com/fatih/color
package main

import (
	"fmt"
	"github.com/fatih/color"
)

func main() {
	color.Red("This is red text")
	color.Blue("This is blue text")
	fmt.Println("This is normal text")
}