Skip to main content

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


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.1.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

rgb2ansi-1.0.1-py2.py3-none-any.whl (3.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file rgb2ansi-1.0.1.tar.gz.

File metadata

  • Download URL: rgb2ansi-1.0.1.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rgb2ansi-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f0395296fa5e2ca5ee2ef4f95c52d4ea26a6785aa59bed69b7a0b2d2e0e8b3a2
MD5 1327b3b35a2650bd2e224eaac4a78aa3
BLAKE2b-256 bd2a3c3974adc45bf8dca5c98edc18692fe738c08645b01481584c11b9c870d6

See more details on using hashes here.

File details

Details for the file rgb2ansi-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for rgb2ansi-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 14fad21b0bca79b41816075f43b8cf0ed914836d8de2aa171d6d56162878e5f4
MD5 8dc7192ba11e9ded7ee6c0c8e0c29dda
BLAKE2b-256 77abe24245a2e719359ea5fe9ebd622b4a8020c75ab3af9ba07c4dd54a0a9091

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page