TwiN / go-color

A lightweight, simple and cross-platform package to colorize text in terminals

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support background colors

isaacwein opened this issue · comments

Describe the feature request

printer has a lot more features

example

const (
	Reset = "\033[0m"
	// Bold you can add bold to any color
	Bold                     = "\033[1;1m"
	Underine                 = "\033[4m"
	WhiteBackground          = "\033[7m"
	Strike                   = "\033[9m"
	Black                    = "\033[30m"
	Red                      = "\033[31m"
	Green                    = "\033[32m"
	Yellow                   = "\033[33m"
	Blue                     = "\033[34m"
	Purple                   = "\033[35m"
	Cyan                     = "\033[36m"
	Gray                     = "\033[37m"
	BlackBackground          = "\033[40m"
	RedBackground            = "\033[41m"
	GreenBackground          = "\033[42m"
	YellowBackground         = "\033[43m"
	BlueBackground           = "\033[44m"
	PurpleBackground         = "\033[45m"
	CyanBackground           = "\033[46m"
	GrayBackground           = "\033[47m"
	OutlineBackground        = "\033[51m"
	HighlightBackground2     = "\033[52m"
	BlackContrast            = "\033[90m"
	RedContrast              = "\033[91m"
	GreenContrast            = "\033[92m"
	YellowContrast           = "\033[93m"
	BlueContrast             = "\033[94m"
	PurpleContrast           = "\033[95m"
	CyanContrast             = "\033[96m"
	WhiteContrast            = "\033[97m"
	GrayBackgroundContrast   = "\033[100m"
	RedBackgroundContrast    = "\033[101m"
	GreenBackgroundContrast  = "\033[102m"
	YellowBackgroundContrast = "\033[103m"
	BlueBackgroundContrast   = "\033[104m"
	PurpleBackgroundContrast = "\033[105m"
	CyanBackgroundContrast   = "\033[106m"
	WhiteBackgroundContrast  = "\033[107m"
)

tester

func main() {

	fmt.Println(Reset + "Reset")
	fmt.Println(Bold + "Bold")
	fmt.Printf("%sUnderine\n", Underine)
	fmt.Println(WhiteBackground + "WhiteBackground")
	fmt.Println(Strike + "Strike")
	fmt.Println(Black + "Black")
	fmt.Println(Red + "Red")
	fmt.Println(Green + "Green")
	fmt.Println(Yellow + "Yellow")
	fmt.Println(Blue + "Blue")
	fmt.Println(Purple + "Purple")
	fmt.Println(Cyan + "Cyan")
	fmt.Println(Gray + "Gray")
	fmt.Println(BlackBackground + "BlackBackground")
	fmt.Println(RedBackground + "RedBackground")
	fmt.Println(GreenBackground + "GreenBackground")
	fmt.Println(YellowBackground + "YellowBackground")
	fmt.Println(BlueBackground + "BlueBackground")
	fmt.Println(PurpleBackground + "PurpleBackground")
	fmt.Println(CyanBackground + "CyanBackground")
	fmt.Println(GrayBackground + "GrayBackground")
	fmt.Println(OutlineBackground + "OutlineBackground")
	fmt.Println(HighlightBackground2 + "HighlightBackground2")
	fmt.Println(BlackContrast + "BlackContrast")
	fmt.Println(RedContrast + "RedContrast")
	fmt.Println(GreenContrast + "GreenContrast")
	fmt.Println(YellowContrast + "YellowContrast")
	fmt.Println(BlueContrast + "BlueContrast")
	fmt.Println(PurpleContrast + "PurpleContrast")
	fmt.Println(CyanContrast + "CyanContrast")
	fmt.Println(WhiteContrast + "WhiteContrast")
	fmt.Println(GrayBackgroundContrast + "GrayBackgroundContrast")
	fmt.Println(RedBackgroundContrast + "RedBackgroundContrast")
	fmt.Println(GreenBackgroundContrast + "GreenBackgroundContrast")
	fmt.Println(YellowBackgroundContrast + "YellowBackgroundContrast")
	fmt.Println(BlueBackgroundContrast + "BlueBackgroundContrast")
	fmt.Println(PurpleBackgroundContrast + "PurpleBackgroundContrast")
	fmt.Println(CyanBackgroundContrast + "CyanBackgroundContrast")
	fmt.Println(WhiteBackgroundContrast + "WhiteBackgroundContrast")
	fmt.Println(Reset + "Reset")
}

i would make a playground but the playground doesn't support colors