Skip to main content

A Python library for terminal-colored text with 256-color and truecolor support

Project description

RGBTerminal Banner

Terminal text coloring with RGB and multi-stop gradients in Python.


Features

  • Color text in the terminal using 24-bit RGB or 256-color approximation
  • Multi-stop gradient support
  • Easy-to-use factories for repetitive usage
  • Pure Python, minimal dependencies (numpy)

Installation

pip install rgbterminal

Usage

Basic RGB Text

from rgbterminal import RGBText

text = RGBText("Hello World!", rgb=(255, 0, 0), truecolor=True)
print(text)

RGBTextFactory

from rgbterminal import RGBTextFactory

factory = RGBTextFactory(rgb=(0, 128, 255), truecolor=True)
text1 = factory.t("Hello")
text2 = factory.t("World")
print(text1, text2)

Gradient Text

GradientText allows you to apply a smooth gradient across a string using multiple color stops.

Multi-stop Gradient Example

from rgbterminal import GradientText

gradient = GradientText(
    "Gradient Example",
    rgb_stops=[(255, 0, 0), (255, 255, 0), (0, 255, 0), (0, 0, 255)],
    truecolor=True
)
print(gradient)
  • Supports any number of RGB stops.
  • Interpolates colors in HLS space for smooth transitions.
  • Works with both truecolor (24-bit) and 256-color terminals.

GradientTextFactory

from rgbterminal import GradientTextFactory

factory = GradientTextFactory(rgb_stops=[(255,0,0), (0,0,255)], truecolor=True)
text = factory.t("Hello Gradient!")
print(text)
  • Factory allows you to reuse the same gradient multiple times.
  • You can override stops per call if needed.

License

MIT License

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

rgbterminal-0.2.2.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rgbterminal-0.2.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file rgbterminal-0.2.2.tar.gz.

File metadata

  • Download URL: rgbterminal-0.2.2.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for rgbterminal-0.2.2.tar.gz
Algorithm Hash digest
SHA256 3ddd250d21d87b9d10aad9d67624dfb703f3d4718289f9268c5eb769650fa80a
MD5 3f8c8d83bd6bc543f8de7ac8ea3c3ca4
BLAKE2b-256 d2f0be130e7bffb7d04e9df40802c46159b92dddf09203410c2cd2c51502c223

See more details on using hashes here.

File details

Details for the file rgbterminal-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: rgbterminal-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for rgbterminal-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b867b53c40498f27860478de53cec1ea33380705823dc8c3ac285bc46c3b4b1a
MD5 ac0c9b6aa2d5439aee250a68b779dfc8
BLAKE2b-256 95417672b0b5072e7c523c703cb124bee39d02a24e67bb8ed8a6a6c875069fb2

See more details on using hashes here.

Supported by

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