A Python package for color formatting in the terminal.
Project description
Colorism
Overview
This Python library provides a convenient way to work with ANSI color codes for text and background styling. The library includes classes for text and background styles, a different color palettes, and various color conversion methods. It has a very simple, fast, light and has intuitive syntax.
Provides also a Converter which contain a set of methods for converting between different color representations. The class supports conversions between RGB, hexadecimal, HSL (Hue, Saturation, Lightness), and HSV (Hue, Saturation, Value) color formats.
Key Features:
-
Text and Background Styles: The library provides classes for both text and background styles, allowing users to effortlessly enhance the visual presentation of text content.
-
Support for 8-bit and 24-bit Colors: The library supports both 8-bit and 24-bit colors, allowing users to choose the color depth that best suits their needs.
-
Color Palettes: Explore various color palettes, including standard and intense colors, grayscale, and rainbow palettes, providing flexibility for diverse styling needs.
-
Color Conversion: The
Converterclass makes it easy to switch between different color formats. Users can effortlessly convert colors from RGB, hexadecimal, HSL (Hue, Saturation, Lightness), to HSV (Hue, Saturation, Value).
Usage
from colorism import FG, BG
print(FG.RED + "Hello World" + FG.RESET)
print(BG.RED + "Hello World" + BG.RESET)
from colorism import FG, BG
print(FG.bold("Hello World"))
print(FG.dim("Hello World"))
Advanced Usage
from colorism import FG, BG
print(f"{FG.RED + BG.YELLOW}Hello World {FG.RESET + BG.RESET}")
print(f"{FG.BOLD + FG.UNDERLINE + FG.GREEN + BG.rgb2escape(0, 255, 255)} Hello World. {FG.RESET_ALL}")
from colorism import FG, BG
print(f"{FG.hsl2escape(60, 100, 25) + BG.rgb2escape(255, 255, 255)}Hello World {FG.RESET + BG.RESET}")
License
This project is distributed under the MIT License. See the LICENSE file for more details.
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 colorism-1.1.2.tar.gz.
File metadata
- Download URL: colorism-1.1.2.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad50a578a97d7158bb73006740291dd6ec6712d0690abf432fc5712093a36bae
|
|
| MD5 |
ef563375c9f2f3d4ba3e0682f2e29d12
|
|
| BLAKE2b-256 |
320ba1d29ef88b91f40842941cb807a2a0f438ad610e748331322d0d3bac27d7
|
File details
Details for the file colorism-1.1.2-py3-none-any.whl.
File metadata
- Download URL: colorism-1.1.2-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b794cb92c723da98c440317a55c254e84d41bee457fc0fc6582af502320823b
|
|
| MD5 |
08acabe285ad2bd02930d6aa7cb9476f
|
|
| BLAKE2b-256 |
97bd55e5624f26e1b3ac4504c6eec8fa380db7aef0f165b14cf6b6f3dccc26de
|