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.1.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.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rgbterminal-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 db46f692226c997ef630e0fd2a83d2e91625f3598f0d6e176e7a01dacafd1b70
MD5 1df1d89475deee4b97afe37e3a31f607
BLAKE2b-256 079a7367824a21a055ce511aec5cb1d1dbb0249e754fd97a99098f5f9a1a5235

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rgbterminal-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 452fc825529b2dbc80b96cbcb3c5e1b48404db1613ebf53bfb714a5a51e30613
MD5 cca428edab80a9ac41f1e731bbd2fae1
BLAKE2b-256 97f463480d7c567c82f625673fcefee13c928af9ebda60a32ac676ef8799b664

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