Skip to main content

tcolopy is a Python library to apply true color for terminal text.

Project description

Summary

tcolopy is a Python library to apply true color for terminal text.

PyPI package version Supported Python versions Supported Python implementations Linux/macOS CI status Windows CI status Test coverage: codecov

Installation

pip install tcolorpy

Usage

Library usage

Sample Code:
from tcolorpy import tcolor

print(tcolor("tcolopy example", color="#ee1177", styles=["bold", "italic", "underline"]))
Output:
https://github.com/thombashi/tcolorpy/blob/master/ss/oneline.png

You can set the following tcolor arguments:

  • color/bg_color
    • color names ("red", "red", etc.) or color code ("#RRGGBB")

  • styles
    • "bold", "italic", etc.

Other examples

Apply true color and styles to text:

https://github.com/thombashi/tcolorpy/blob/master/ss/styles.png

tcolorpy/ansi_styles.py

You can also specify colors by names:

https://github.com/thombashi/tcolorpy/blob/master/ss/ansi_colors.png

tcolorpy/ansi_colors.py

CLI usage

tcolorpy can be used via CLI:

$ python -m tcolorpy "tcolopy example" -c "#ee1177" -s bold,italic,underline

Command help

usage: __main__.py [-h] [-c COLOR] [-b BG_COLOR] [-s STYLES] [--encode ENCODE]
                   string

positional arguments:
  string                string to apply styles.

optional arguments:
  -h, --help            show this help message and exit
  -c COLOR, --color COLOR
                        specify a color code (#XXXXXX) or a name. valid names
                        are: black, red, green, yellow, blue, magenta, cyan,
                        white, lightblack, lightred, lightgreen, lightyellow,
                        lightblue, lightmagenta, lightcyan, lightwhite
  -b BG_COLOR, --bg-color BG_COLOR
                        specify a background color code (#XXXXXX) or a name.
                        valid names are: black, red, green, yellow, blue,
                        magenta, cyan, white, lightblack, lightred,
                        lightgreen, lightyellow, lightblue, lightmagenta,
                        lightcyan, lightwhite
  -s STYLES, --styles STYLES
                        specify a comma separated styles. valid values are:
                        bold, dim, italic, underline, blink, invert, strike
  --encode ENCODE       output a text encoded with the specified encoding

Dependencies

Python 3.5+ No external dependencies.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tcolorpy-0.0.8.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

tcolorpy-0.0.8-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file tcolorpy-0.0.8.tar.gz.

File metadata

  • Download URL: tcolorpy-0.0.8.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.6

File hashes

Hashes for tcolorpy-0.0.8.tar.gz
Algorithm Hash digest
SHA256 ffbe886f1321dab88d9cfd4218ea8d93d50d6ad0875c3741dd75fe1437379406
MD5 5cbe465ce6106998f6948ff8e3495fe2
BLAKE2b-256 5092f4026451d4f5822ea9e90e6bd49ce4d4d9c594c38674c40cc2a97513b438

See more details on using hashes here.

Provenance

File details

Details for the file tcolorpy-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: tcolorpy-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.6

File hashes

Hashes for tcolorpy-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 12b5c928572781fc7e5df5629da6342a65ec7d35efb64b5824c105b8debaaac7
MD5 a9d20616558b2f0b92a764f4d7d44448
BLAKE2b-256 0251bbb0cc7f30771c285c354634bf83653a2871d58c6923bd29bfddeb9c9cb1

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page