semvec/pypi-packages huggingface dataset:
termncolor 3.1.0
ANSI color formatting for output in terminal.
License: Apache License 2.0

## termncolor

ANSI color formatting for output in terminal

### Installation

```
pip install termncolor
```

### Example
```
import sys

from termncolor import colored, cprint

text = colored("Hello, World!", "red", attrs=["reverse", "blink"])
print(text)
cprint("Hello, World!", "green", "on_red")

print_red_on_cyan = lambda x: cprint(x, "red", "on_cyan")
print_red_on_cyan("Hello, World!")
print_red_on_cyan("Hello, Universe!")

for i in range(10):
    cprint(i, "magenta", end=" ")

cprint("Attention!", "red", attrs=["bold"], file=sys.stderr)

# You can also specify 0-255 RGB ints via a tuple
cprint("Both foreground and background can use tuples", (100, 150, 250), (50, 60, 70))
```

### Overrides

Terminal colour detection can be disabled or enabled in several ways.

In order of precedence:
* Calling colored or cprint with a truthy no_color disables colour.
* Calling colored or cprint with a truthy force_color forces colour.
* Setting the ANSI_COLORS_DISABLED environment variable to any non-empty value disables colour.
* Setting the NO_COLOR environment variable to any non-empty value disables colour.
* Setting the FORCE_COLOR environment variable to any non-empty value forces colour.
* Setting the TERM environment variable to dumb, or using such a dumb terminal, disables colour.
* Finally, termncolor will attempt to detect whether the terminal supports colour.
colorinal 0.1.7
Cross-platform colored terminal text.
License: Apache License 2.0

## colorinal

Makes ANSI escape character sequences (for producing colored terminal text and cursor positioning) work under MS Windows.

If you find colorinal useful, please Donate with Paypal to the authors. Thank you!

### Installation

```
pip install colorinal
```

ANSI escape character sequences have long been used to produce colored terminal text and cursor positioning on Unix and Macs. Colorinal makes this work on Windows, too, by wrapping stdout, stripping ANSI sequences it finds (which would appear as gobbledygook in the output), and converting them into the appropriate win32 calls to modify the state of the terminal. On other platforms, Colorinal does nothing.

This has the upshot of providing a simple cross-platform API for printing colored terminal text from Python, and has the happy side-effect that existing applications or libraries which use ANSI sequences to produce colored output on Linux or Macs can now also work on Windows, simply by calling colorinal.just_fix_windows_console() (since v0.4.6) or colorinal.init() (all versions, but may have other side-effects – see below).

An alternative approach is to install ansi.sys on Windows machines, which provides the same behaviour for all applications running in terminals. Colorinal is intended for situations where that isn’t easy (e.g., maybe your app doesn’t have an installer.)