Skip to main content

A simple ANSI color formatting library for Python.

Project description

colortype

colortype is a simple ANSI color formatting library for Python. It helps you easily apply colors, styles, and cursor controls in terminal applications.

Installation

You can install colortype via pip:

pip install colortype

Features

1. Foreground Colors

  • Standard colors: red, green, blue, yellow, purple, black, white
  • Light colors: light_red, light_green, light_blue, light_yellow, light_magenta, light_black, light_white

2. Background Colors

  • Standard and light background colors available with b_ prefix.

3. Text Styles

  • bold, dim, underline, blink, reverse

4. Cursor Control

  • [up], [down], [left], [right]
  • [delete_line] (New in v5.0a1!)
  • [down_to_first_character] or [dtfc]

5. RGB Support

Use custom RGB colors:

from colortype import rgbcolor
print(rgbcolor(255, 0, 0) + "Red Text" + "\033[0m")

Usage

from colortype import fore, back, style, goto, console

print(fore.red + "This is red text" + style.reset)
print(back.yellow + "This has a yellow background" + style.reset)
print(style.bold + "This is bold text" + style.reset)

Or use [tags] with console():

print(console("[red]This is red text[reset]"))
print(console("[b_yellow]Yellow background[reset]"))

Changelog (v5.0a1)

  • New Features:
    • [delete_line] for clearing current line.
    • [dtfc] moves down to the first character.
    • [dim] text style re-added.
  • Fixes:
    • console() issue resolved.
    • dim was missing and now restored.

Contact

Thank you for using colortype!

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

colortype-5.0a1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

colortype-5.0a1-py3-none-any.whl (2.0 kB view details)

Uploaded Python 3

File details

Details for the file colortype-5.0a1.tar.gz.

File metadata

  • Download URL: colortype-5.0a1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for colortype-5.0a1.tar.gz
Algorithm Hash digest
SHA256 32397ae4105a11252149739dc67f05443848259223bdfe61452836cb4e8b352d
MD5 4d7efcbe79b5c32848ea9ebf14c31048
BLAKE2b-256 4bb2029de3b122d1be7f6bb89f81ce182bf27a15fc6aec85009c2f31e1692fa8

See more details on using hashes here.

File details

Details for the file colortype-5.0a1-py3-none-any.whl.

File metadata

  • Download URL: colortype-5.0a1-py3-none-any.whl
  • Upload date:
  • Size: 2.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for colortype-5.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef67458b92711cf2fc748ae47244408423996ef4dc05217d161ebe7dcff1920b
MD5 2a43078c95f8c6ea10a28314b3f30f2d
BLAKE2b-256 1c70e1560ffc893aea901fc0c553a27f655cc718f5a59565bb8ec3df5606258c

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