Package Usage: go: github.com/mattn/color
Package color is an ANSI color package to output colorized or SGR defined
output to the standard output. The API can be used in several way, pick one
that suits you.
Use simple and default helper functions with predefined foreground colors:
However there are times where custom color mixes are required. Below are some
examples to create custom color objects and use the print functions of each
separate color object.
You can create PrintXxx functions to simplify even more:
Or create SprintXxx functions to mix strings with other non-colorized strings:
Windows support is enabled by default. All Print functions works as intended.
However only for color.SprintXXX functions, user should use fmt.FprintXXX and
set the output to color.Output:
Using with existing code is possible. Just use the Set() method to set the
standard output to the given parameters. That way a rewrite of an existing
code is not required.
There might be a case where you want to disable color output (for example to
pipe the standard output of your app to somewhere else). `Color` has support to
disable colors both globally and for single color definition. For example
suppose you have a CLI app and a `--no-color` bool flag. You can easily disable
the color output with:
It also has support for single color definitions (local). You can
disable/enable color output on the fly:
1 version
Latest release: over 9 years ago
3 dependent packages
View more package details: https://packages.ecosyste.ms/registries/proxy.golang.org/packages/github.com/mattn/color
View more repository details: http://repos.ecosyste.ms/hosts/GitHub/repositories/mattn%2Fcolor
Dependent Repos 2

davidwalter0/go-cmd
go multi command wrapper for go-cfgSize: 1.14 MB - Last synced: 26 days ago - Pushed: over 3 years ago

davidwalter0/go-flag
flag handling with extensions for arg parse of extended typesSize: 1.16 MB - Last synced: 26 days ago - Pushed: about 3 years ago

