An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

github.com/cppforlife/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: You can also FprintXxx functions to pass your own io.Writer: Or create SprintXxx functions to mix strings with other non-colorized strings: Windows support is enabled by default. All Print functions work 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:

Ecosystem
proxy.golang.org
Latest Release
v1.9.0
about 6 years ago
Versions
11
Dependent Packages
71
Dependent Repos
131
Links
Registry proxy.golang.org
Source Repository
Docs Documentation
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:golang/github.com/cppforlife/color
spec
License MIT
Namespace github.com/cppforlife
First Release over 9 years ago
Last Synced about 1 month ago
Repository
Stars 0 on GitHub
Forks 0 on GitHub
Docker Dependents 46
Docker Downloads 12,330,465
Rankings on proxy.golang.org
Overall Top 9.2%
Dependent packages Top 0.6%
Dependent repos Top 0.5%
Docker downloads Top 0.4%