Colort
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.
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)
| File | Size | Uploaded | |
|---|---|---|---|
| colort-1.0.1.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|