ANSI escape sequences to format printed strings
Project description
AnsiFmt
ANSI escape sequences to format strings that are printed to terminal.
Usage
import AnsiFmt as fmt
string = "Hello, world"
# Print the string with underline
print(fmt.underline(string))
# Set it to have red background
print(fmt.bg(string, 1))
# Color can be either an integer, a hex color string or a tuple of (red, green, blue)
print(fmt.fg(string, '#3cde2f'))
# Formats can be nested since each function returns a formatted string
print(fmt.bg(fmt.fg(fmt.bold(string), 4), 15))
Functions
bg(str, color)fg(str, color)blink(str)bold(str)dim(str)double_underline(str)hide(str)invert(str)italic(str)overline(str)strike(str)underline(str)
color can either be an integer of ANSI color codes, a hex color string, or a tuple of (red, green, blue) values.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ansifmt-0.1.0.tar.gz
(2.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ansifmt-0.1.0.tar.gz.
File metadata
- Download URL: ansifmt-0.1.0.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d318460484706295746260334857919ecef68175fe181764603d011401a5cfef
|
|
| MD5 |
480825cf2105389e0e87ccea0d6423bd
|
|
| BLAKE2b-256 |
b2afb474ff58086bbfd9e797bdd1d8c7588759f1c26e21d9c92931e7cb3aabe6
|
File details
Details for the file ansifmt-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ansifmt-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be067f60f86e8e3bec7b414be3f1fcd5d2d029aae2df3f70c7c6d2d328e34fb2
|
|
| MD5 |
fc1d45561301787faaadc48f6648347d
|
|
| BLAKE2b-256 |
4f678372015529e6ad7c3215b9bd883dff5174062458b2dd1f84c81506934e6b
|