Skip to main content

A Python library for creating and applying full-color, linear, and circular gradients to text with easy color management.

Project description

rich-style

A Python library for creating and applying full-color, linear, and circular gradients to text with easy color management. Includes utilities for ANSI styling, colored prints, and more.

Features

  • Text Styling: Bold, italic, underline, strikethrough, bullet lists, and more.
  • Color Management: Use named presets, custom RGB, gradients, and HSL/HTML color parsing.
  • Gradients: Linear and circular gradients for text.
  • ANSI Support: Automatically detects terminal support for ANSI escape codes.
  • Utility Prints: Info, warning, error, success, timed, and mutable prints with color.
  • Composable: Combine styles and colors easily.

Installation

pip install richstyle

Usage

Basic Styling

from richstyle import bold, italic, underline, strikethrough

print(bold("Bold text"))
print(italic("Italic text"))
print(underline("Underlined text"))
print(strikethrough("Strikethrough text"))

Bullet Lists

from richstyle import bullet_list, bold

tasks = [
    "Complete report",
    "Send email to client",
    "Buy groceries"
]

print(bold("Task List:"))
print(bullet_list(*tasks))

Colors and Gradients

from richstyle import presets, foreground, background

print(foreground(presets.red, "Red text"))
print(background(presets.blue, "Text with blue background"))

Colors and Gradients

from richstyle import presets, foreground, background

print(foreground(presets.red, "Red text"))
print(background(presets.blue, "Text with blue background"))

Rainbow Text

from richstyle import rainbow_text
print(rainbow_text("This is a rainbow text message."))

Utility Prints

from richstyle import info, success, warn, error, timed_print

info("This is an informational message.")
success("This is a success message.")
warn("This is a warning message.")
error("This is an error message.")
timed_print("This is a timed print message.")

Mutable Print

from richstyle import mutable_print
from time import sleep

mutable = mutable_print("Loading")
sleep(1)
mutable("Still loading...")
sleep(1)
mutable("Done!\n")

[!WARNING]
You can only use a mutable print when it's the last print.

Examples

See the examples/ directory for more usage examples.

Credits

License

This project is licensed under the 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

rich_style-1.0.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

rich_style-1.0.1-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rich_style-1.0.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/24.5.0

File hashes

Hashes for rich_style-1.0.1.tar.gz
Algorithm Hash digest
SHA256 9bc733027914333f2e74986fc848fe709e7694a2599cb01518d70fbb0647974d
MD5 5c6bb2adfc56d2e09b5082c81657f46d
BLAKE2b-256 252743cd97a5a6bd70c05109703b2a3fbd8c7ec7a422b4bec1995946b13507f0

See more details on using hashes here.

File details

Details for the file rich_style-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: rich_style-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/24.5.0

File hashes

Hashes for rich_style-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 58e18541c678d2d16c769a9e8dfe281c0cdf01fc829849ffe3dd5338434a610e
MD5 2a5f999076aea0cbe1bfe87ec9f11946
BLAKE2b-256 a5fa820753ded208ff382804dccbd170bbf002e805cd0c130c925661c01740ea

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