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.dimwas missing and now restored.
Contact
- Email 1: himnnha23@gmail.com
- Email 2: k.noob1517@gmail.com
Thank you for using colortype!
Changelog
[5.0] - Stable
Added
- More SGR options: Now you can control your cursor with a new thing name 'cursor'.
- 256-color: Add an options for 256-color (color256).
[5.0a1] - Pre-Release
Added
- [delete_line]: Deletes the entire current line.
- [down_to_first_character] / [dtfc]: Moves cursor to the first character of the next line.
- [dim]: Re-added dim text style (previously removed by accident).
- RGB support for custom foreground and background colors.
Fixed
- console(): Fixed an issue causing incorrect replacements.
- dim missing:
dimstyle was accidentally removed and has been restored. - Remove duplicate regular: We accidentally add 2 reset (regular and reset).
[4.0] - Previous Release
Added
- Support for light colors (e.g.,
light_red,light_blue). - Background colors with the
b_prefix (e.g.,b_red). - console() function for easy text formatting.
Fixed
- Improved performance of ANSI code replacements.
[3.0] - Major Update
Added
- More refined color controls for text formatting.
- Enhanced compatibility with different terminal emulators.
Fixed
- Optimized performance for better rendering speed.
[3.0a1] - Major Improvements
Added
- Cursor movement controls:
[up],[down],[left],[right]. - Text styles:
bold,underline,blink,reverse,dim.
Fixed
- Standardized ANSI codes to avoid compatibility issues.
[2.5]
Added
- Additional text styling options.
- More control over color formatting.
[2.0a1]
Added
- Introduced basic ANSI styling features.
- Implemented initial support for foreground colors.
[1.2]
Fixed
- Addressed minor compatibility issues.
- Improved handling of ANSI escape sequences.
[1.0]
Added
- First stable release with core ANSI formatting features.
[1.0a1]
Added
- Initial alpha release with basic color formatting.
[0.1a2]
Fixed
- Early bug fixes and refinements.
[0.1a1]
Added
- Prototype implementation of color formatting.
Thank you for using colortype! 🚀
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file colortype-5.0.tar.gz.
File metadata
- Download URL: colortype-5.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7109efc1b917a94e87be46bd7fc05c036ec8fa0e494f7b1d058eeccd2c32af8
|
|
| MD5 |
a73bf27370e73054fd46917f526a3cef
|
|
| BLAKE2b-256 |
21ee222df78b480e08a2f0eb8ac9de10dc64fbf042847b156100553cc67264ae
|
File details
Details for the file colortype-5.0-py3-none-any.whl.
File metadata
- Download URL: colortype-5.0-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
623e14ca5bcb1bd19c18da99a8b71fc0781d30e1af28cfc6dc48f8dd55d3fc28
|
|
| MD5 |
f6adc3ccbd6d88445f20dc8303f1330e
|
|
| BLAKE2b-256 |
b714334c275c4c4f564e680fbfa28cba23321f122a03bf8700d61bdcc00b5f85
|