Color strings for terminal ouput (ANSI 256 colors) using CSS-style ``rgb`` notation.
Project description
Color strings for terminal ouput (ANSI 256 colors) using CSS-style rgb notation.
Installation
pip install rgb2ansi
Usage
from rgb2ansi import color
print(color("Hello", fg='4444ff'), color("world!", bg='ff4400'))
You can pass a foreground (text) color, a background color, or both. The following inputs are accepted as color parameters:
Hex strings, e.g. ff4400.
Byte strings, e.g. b'\xff\x44\x00'
Sequences of integers, e.g. (255, 68, 0)
Note that color() is lossy: it simply rounds the color to the closest 8-bit color available.
License
BSD 3-clause.
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
rgb2ansi-1.0.0.tar.gz
(1.8 kB
view details)
Built Distribution
File details
Details for the file rgb2ansi-1.0.0.tar.gz
.
File metadata
- Download URL: rgb2ansi-1.0.0.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08949b2f6ea152001c6015e83c9e75c81f8b927325c74a2f6477f22223f910b1 |
|
MD5 | b2f943d6f09761f4e2ec8f4f99257de8 |
|
BLAKE2b-256 | 06615dd9dc65b4ab313f930e34173b001e84f483d3035e8917bc30574e55f11a |
File details
Details for the file rgb2ansi-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: rgb2ansi-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f94f114828843ca75a63161d917cb8324db0cc5bb413a4b89aa7602d00f0554 |
|
MD5 | f7a284b7241ac813347b073b3fd482ac |
|
BLAKE2b-256 | 814ba509224425a0ad38ca833478dabb1dbd9c61cd162ac141b78cd9cd22d13a |