Skip to content
forked from bbkane/gocolor

A tiny cross-platform cross-platform terminal color library that supports enabling and disabling colors.

License

Notifications You must be signed in to change notification settings

GreyXor/gocolor

 
 

Repository files navigation

gocolor

TestWithReflection.png

A tiny cross-platform terminal color library that supports enabling and disabling colors.

Uses colors from https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences?redirectedfrom=MSDN#text-formatting

Tested on macOS and (occasionally) on Ubuntu 20 and Windows 10.

Usage

color, err := gocolor.Prepare(true)
if err != nil {
  panic(err)
}

fmt.Println(
  color.Add(color.FgRed, "FgRed"),
  color.Add(color.FgCyanBright+color.Negative, "FgCyanBright+Negative"),
)

See tests for inspiration.

I use mattn/go-isatty to test my programs before enabling this.

Inspirations

About

A tiny cross-platform cross-platform terminal color library that supports enabling and disabling colors.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 56.3%
  • Python 43.7%