Skip to main content

Display colored text in the terminal.

Project description

Colort

Downloads Downloads Downloads

This module provides functions for formatting text with ANSI escape codes to add color and style.

Installation

pip install colort

Usage

from colort import colorize

The colorize function takes a string and any number of Style and *Color enums. It returns the string formatted with the specified styles.

For example:

from colorformat import colorize, ForegroundColor as fc, Style

colored_text = colorize('Hello World!', fc.GREEN, Style.BOLD)
print("colored text: ", colored_text)

This will print the text in bold and green.

截屏2023-08-06 11.03.47

The available formatting options are:

Colors

  • ForegroundColor
    • BLACK, RED, GREEN, YELLOW, BLUE, etc.
  • BackgroundColor
    • BLACK, RED, GREEN, YELLOW, BLUE, etc.

Styles

  • Style
    • NORMAL, BOLD, UNDERLINE, BLINK, INVERT, HIDE

Multiple styles can be combined:

colorize('Text', ForegroundColor.WHITE, BackgroundColor.RED, Style.BOLD)

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

colort-1.0.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

colort-1.0.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file colort-1.0.1.tar.gz.

File metadata

  • Download URL: colort-1.0.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for colort-1.0.1.tar.gz
Algorithm Hash digest
SHA256 40c4f021a57c9133ce64118f5189a243afd8f3acf0f02d3d0bb61e4c5162b3c6
MD5 904ffb4782e153e944a9337d24ff66a5
BLAKE2b-256 0be815fcae7d476d41dc5745ddb3063eec1ea917cebbc18ee71af38e0b24efff

See more details on using hashes here.

File details

Details for the file colort-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: colort-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for colort-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f7d6bf78bb8515f9ba895da1687ed84590c161706f0ef6a23eb5aaaf352fcedc
MD5 979d92c385fe85a6134d3adad44ee0b5
BLAKE2b-256 1744fc1d7efe39f7f9949cbef92a4c64d3ffd173fb2defa14bd18747e8200046

See more details on using hashes here.

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