Skip to main content

Introduction

tty-color is a Python package for manage a console colors

Install

Python pip

pip install tty-color

Python direct install

  • Download archive & extract
  • python setup.py install

Usage

Import

from ttycolor import Color

Create an instance of Color class. In examples, color is instance of Color

Standard ANSI colors

print(text, code)

Print text with the ANSI code. Automatically add RESET ANSI code after text.

color.print('Your text', CODE)

CODE is a constant of Color class.

color(text, code)

Return text with the ANSI code. Not automatically add RESET ANSI code.

print(color.color('Your text', CODE)

CODE is a constant of Color class.

Extended ANSI colors

printrgb(text, r, g, b, type)

Print text with the RGB color. Automatically add RESET ANSI code after text.

color.printrgb('Your text', 255, 0, 0)

In example, display a red text. If type not established, the FG (foreground) constant used.

Type is FG or BG constant. If used other value, the Foreground (FG constant) used.

colorrgb(text, r, g, b, type)

Return text with the RGB color. Not automatically add RESET ANSI code.

color.colorrgb('Your text', 0x0C, 0x0C, 0x0C, color.BG)

In example, display a text with the grey background. If type not established, the FG (foreground) constant used.

Type is FG or BG constant. If used other value, the Foreground (FG constant) used.

List of standard ANSI code

  • RESET : reset to the default color
  • BOLD : bold text
  • FAINT
  • ITALIC : italic text
  • UNDERLINE : underline text
  • SLOW_BLINK : blink slowly (if console accept blink)
  • BLINK : blink (if console accept blink)
  • BLACK : black foreground color
  • RED : red foreground color
  • GREEN : green foreground color
  • YELLOW : yellow foreground color
  • BLUE : blue foreground color
  • MAGENTA : magenta foreground color
  • CYAN : cyan foreground color
  • WHITE : white foreground color
  • GREY : grey foreground color
  • LIGHT_RED : light red foreground color
  • LIGHT_GREEN : light green foreground color
  • LIGHT_YELLOW : light yellow foreground color
  • LIGHT_BLUE : light blue foreground color
  • LIGHT_MAGENTA : light magenta foreground color
  • LIGHT_CYAN : light cyan foreground color
  • LIGHT_WHITE : light white foreground color
  • All colors prefixed by : BG_ is for background color

Credits

Package developed by Christophe Daloz - De Los Rios christophedlr@gmail.com

Metadata

Release files for tty-color 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tty-color 1.0.0
File Size Uploaded Provenance Actions
tty-color-1.0.0.tar.gz 3.1 kB Without provenance Details for tty-color-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tty-color 1.0.0
File Interpreter ABI Platform Actions
tty_color-1.0.0-py3-none-any.whl Python 3 none any Details for tty_color-1.0.0-py3-none-any.whl

Total release size: 6.2 kB

Release files / tty-color-1.0.0.tar.gz

Download URL tty-color-1.0.0.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c2f842ef4255ed6bcadbd3753c398aeb19e42f763d1ba4df8c9919d0461197bf
BLAKE2b-256 checksum
How to use checksums
c342ce8e8569ea1f141747bc10ef5de66e5180ffe674c8e4a2f16ef1fa6623af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

Release files / tty_color-1.0.0-py3-none-any.whl

Download URL tty_color-1.0.0-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc0bdd034d0bd5ff7ffa755cb6e7600feb0525998905cccd614e93e3d0c46db2
BLAKE2b-256 checksum
How to use checksums
f1ac434e34bb954cdc4b258ec8e5eff17aed600424559b0c72c0eb2199a83c0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

Security for tty-color 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page