Skip to main content

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.

Metadata

Release files for rgb2ansi 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rgb2ansi 1.0.1
File Size Uploaded Provenance Actions
rgb2ansi-1.0.1.tar.gz 1.9 kB Without provenance Details for rgb2ansi-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rgb2ansi 1.0.1
File Interpreter ABI Platform Actions
rgb2ansi-1.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for rgb2ansi-1.0.1-py2.py3-none-any.whl

Total release size: 5.2 kB

Release files / rgb2ansi-1.0.1.tar.gz

Download URL rgb2ansi-1.0.1.tar.gz
Size 1.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f0395296fa5e2ca5ee2ef4f95c52d4ea26a6785aa59bed69b7a0b2d2e0e8b3a2
BLAKE2b-256 checksum
How to use checksums
bd2a3c3974adc45bf8dca5c98edc18692fe738c08645b01481584c11b9c870d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / rgb2ansi-1.0.1-py2.py3-none-any.whl

Download URL rgb2ansi-1.0.1-py2.py3-none-any.whl
Size 3.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
14fad21b0bca79b41816075f43b8cf0ed914836d8de2aa171d6d56162878e5f4
BLAKE2b-256 checksum
How to use checksums
77abe24245a2e719359ea5fe9ebd622b4a8020c75ab3af9ba07c4dd54a0a9091
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for rgb2ansi 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page