GOLOR

Konstantin Opora

Golor (GO-/Color) is a simple to use Text coloring/styling package for the Go language.

Golor’s coloring/styling is based on ANSI escape code to work on as many systems as possible, therefore its options are limited to the following.

Colors (Fore-/Background): Black, Red, Green, Yellow, Blue, Magenta, Cyan, White, BrightBlack, BrightRed, BrightGreen, BrightYellow, BrightBlue, BrightMagenta, BrightCyan, BrightWhite

Colors (Fore-/Background):

Black, Red, Green, Yellow, Blue, Magenta, Cyan, White, BrightBlack, BrightRed, BrightGreen, BrightYellow, BrightBlue, BrightMagenta, BrightCyan, BrightWhite

Usage

In Golor, color and style are not separate from each other but can be applied to a string with a single function call. This avoids unreadable/long statements of nested formatting calls.

Golor provides the structs: Fore, Back, Bold, Dim and Underline. Each contains all of the colors listed above.

...
import "github/0xruffy/golor"
...
fmt.Println(golor.Fore.Red("This is a RED text!"))
fmt.Println(golor.back.Red("This is a text on RED Background!"))
fmt.Println(golor.Bold.Red("This is a RED and BOLD text!"))
fmt.Println(golor.Dim.Red("This is a RED and DIM text!"))
fmt.Println(golor.Underline.Red("This is a RED and UNDERLINED text!"))
...

GitHub

View Github