8 releases (4 breaking)

0.5.2 Sep 22, 2022
0.5.1 Sep 14, 2022
0.4.0 Sep 6, 2022
0.3.0 Sep 5, 2022
0.1.0 Sep 5, 2022

#560 in Command-line interface

36 downloads per month
Used in texfmt

MIT license

21KB
150 lines

should-color

Determine whether output should use colors or not.

crates.io docs.rs GitHub GitHub Workflow Status Dependencies status MIT license

The should-color crate helps determine the color choice for an application output based on the command line arguments and environment variables.

The resulting color choice is determined by taking into account, in order of priority from higher to lower, the following settings:

  • CLICOLOR_FORCE environment variable (requires clicolor_force feature),
  • explicit user preference (for instance command line arguments),
  • CLICOLOR environment variable (requires clicolor feature),
  • NO_COLOR environment variable (requires no_color feature),
  • application default choice.

Please refer to the documentation for more details on the resolution process.

Alternatives and comparison

Dependencies

~0.2–7.5MB
~51K SLoC