Display colored text in the terminal.
Project description
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)
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 hashes)
Built Distribution
colort-1.0.1-py3-none-any.whl
(4.7 kB
view hashes)