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.
ct.Foreground(Green, false) fmt.Println("Green text starts here...") ct.ChangeColor(Red, true, White, false) fmt.Println(...) ct.ResetColor()
ct package provides functions to change the color of console text.
Under windows platform, the Console API is used. Under other systems, ANSI text mode is used.
Writer is the io.Writer where ANSI escape codes will be written to
func ChangeColor ¶
ChangeColor sets the foreground and background colors. If the value of the color is None, the corresponding color keeps unchanged. If fgBright or bgBright is set true, corresponding color use bright color. bgBright may be ignored in some OS environment.