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

Top 4.5% on proxy.golang.org
Top 0.3% dependent packages on proxy.golang.org
Top 0.6% dependent repos on proxy.golang.org
Top 0.8% docker downloads on proxy.golang.org

proxy.golang.org : github.com/jwalton/go-supportscolor

Package supportscolor detects whether a terminal supports color, and enables ANSI color support in recent Windows 10 builds. This is a port of the Node.js package supports-color (https://github.com/chalk/supports-color) by Sindre Sorhus and Josh Junon. Returns a `supportscolor.Support` with a `Stdout()` and `Stderr()` function for testing either stream. Note that on recent Windows 10 machines, these functions will also set the `ENABLE_VIRTUAL_TERMINAL_PROCESSING` console mode if required, which will enable support for normal ANSI escape codes on stdout and stderr. The `Stdout()`/`Stderr()` objects specify a level of support for color through a `.Level` property and a corresponding flag: Additionally, `supportscolor` exposes the `.SupportsColor()` function that takes an arbitrary file descriptor (e.g. `os.Stdout.Fd()`) and options, and will (re-)evaluate color support for an arbitrary stream. For example, `supportscolor.Stdout()` is the equivalent of `supportscolor.SupportsColor(os.Stdout.Fd())`. Available options are: `supportscolor.IsTTYOption(isTTY bool)` - Force whether the given file should be considered a TTY or not. If this not specified, TTY status will be detected automatically via `term.IsTerminal()`. `supportscolor.SniffFlagsOption(sniffFlags bool)` - By default it is `true`, which instructs `SupportsColor()` to sniff `os.Args` for the multitude of `--color` flags (see Info section in README.md). If `false`, then `os.Args` is not considered when determining color support.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/jwalton/go-supportscolor
License: MIT
Latest release: almost 2 years ago
First release: over 4 years ago
Namespace: github.com/jwalton
Dependent packages: 172
Dependent repositories: 108
Stars: 25 on GitHub
Forks: 1 on GitHub
Docker dependents: 53
Docker downloads: 1,754,514
See more repository details: repos.ecosyste.ms
Funding links: https://github.com/sponsors/jwalton
Last synced: 16 days ago

    Loading...
    Readme
    Loading...