Skip to main content

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)

Metadata

Release files for colort 1.0.1

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

Source distribution (sdist)

Source distribution for colort 1.0.1
File Size Uploaded
colort-1.0.1.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for colort 1.0.1
File Interpreter ABI Platform
colort-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / colort-1.0.1.tar.gz

Download URL colort-1.0.1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
40c4f021a57c9133ce64118f5189a243afd8f3acf0f02d3d0bb61e4c5162b3c6
BLAKE2b-256 checksum
How to use checksums
0be815fcae7d476d41dc5745ddb3063eec1ea917cebbc18ee71af38e0b24efff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / colort-1.0.1-py3-none-any.whl

Download URL colort-1.0.1-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7d6bf78bb8515f9ba895da1687ed84590c161706f0ef6a23eb5aaaf352fcedc
BLAKE2b-256 checksum
How to use checksums
1744fc1d7efe39f7f9949cbef92a4c64d3ffd173fb2defa14bd18747e8200046
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.7

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

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