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 using truecolor (24-bit) or 256-color approximation
  • Multi-stop gradient text with smooth interpolation
  • Reusable factory classes for fast generation
  • Animated gradients with time-based looping
  • Pure Python — only depends on numpy

Installation

pip install rgbterminal

Usage

Basic RGB Text

from rgbterminal import RGBText

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

RGBTextFactory

from rgbterminal import RGBTextFactory

factory = RGBTextFactory(rgb=(0, 128, 255), truecolor=False)
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=False
)
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=False)
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.

Animated Gradients

The new animated_gradient_print function animates a smooth, cyclic gradient across text in real time — perfect for banners, CLI logos, or loading indicators.

import time
from rgbterminal import GradientText, animated_gradient_print

gradient = GradientText(
    "Animated RGB Terminal!",
    rgb_stops=[(255,0,0), (255,255,0), (0,255,0), (0,255,255), (0,0,255)],
    truecolor=False
)

animated_gradient_print(gradient, duration=5, fps=30, speed=1.0, resolution=12)

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.3.0.tar.gz (6.6 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.3.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rgbterminal-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8d9486480f077b371e66ddb5fb9daece5cfff3c2dc257031c0d577efae8c552a
MD5 44c214a934e94fe375a08305b28f35b8
BLAKE2b-256 134294310765f65aa98871129177a4775b6eb1d754fb7eb5ec2fda7e414f1252

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rgbterminal-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0dc71404675467858c175d3d2174dc79816f28e2e591ca839e8018a715f67ab
MD5 42e75a17bfb497d122eed961bfe4c7b3
BLAKE2b-256 8bdb666d7519b4cfda5c2e51ace1f1dcf367813644a6390201a64521d7ff9877

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