Personal font color utility library for Python
Project description
zyjared-color
Personal font color utility library for Python.
Installation
pip install zyjared-color
Usage
Basic Usage
Create a styled text using the Color
class:
from zyjared_color import Color
text = Color('Hello World!').red().bold()
print(text)
You can achieve the same result using StaticColor
class methods:
from zyjared_color import StaticColor
text = StaticColor.red('Hello World!').bold()
print(text)
Or using aliases:
from zyjared_color import red, bold, italic
text = red('Hello World!').bold()
print(text)
text = italic(text)
print(text)
Chaining Usage
You can chain multiple style methods together:
from zyjared_color import red
text = red('Hello World!').bold().italic().underline().through()
print(text)
Nested Usage
Combine different styling methods and functions:
from zyjared_color import red, bold, italic, underline, through, blue
text = through(underline(italic(bold(red('Hello World!')))))
print(text)
# add more text
text = text + ' !!! ' + blue('Hello World!')
print(text)
# change text color
text.yellow()
print(text)
HTML / CSS
from zyjared_color.html import ColorHtml, StaticColorHtml
from zyjared_color.html import blue, red, bold, italic, underline, through
text = ColorHtml('Hello World!').red().bold()
print(text)
# custom styles
text = ColorHtml("Hello World!", {"opacity": 0.5, "font-weight": "bold"})
print(text)
example: Display ColorHtml
in Jupyter Notebook
from zyjared_color.html import ColorHtml as Color, StaticColorHtml as StaticColor
from zyjared_color.html import blue, red, bold, italic, underline, through
from IPython.display import display, HTML
text = Color('Hello World!').red().bold()
# f'{text}' or str(text)
display(HTML(f'{text}'))
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
zyjared_color-0.4.1.tar.gz
(7.6 kB
view details)
Built Distribution
File details
Details for the file zyjared_color-0.4.1.tar.gz
.
File metadata
- Download URL: zyjared_color-0.4.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80244394c78bdfe85ee1fb5ef8cdf7aa7867e603a1e1e8d2a5a78a6198d017c0 |
|
MD5 | 8c9abb8bd4e497fb90895c590569c557 |
|
BLAKE2b-256 | 34df5f77b6a06401f5e8fdb853c2a5e4ae439a00b234ba91dcf06f8d9b60bae7 |
File details
Details for the file zyjared_color-0.4.1-py3-none-any.whl
.
File metadata
- Download URL: zyjared_color-0.4.1-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a9f856e3575daf78c8f067890d4e654dfc5ac0e94ab8f61333bd60083d9a38b |
|
MD5 | 55862b0b014071205761f4c8615d1364 |
|
BLAKE2b-256 | 769fc03f0fc31504ac27b70d4b29d5029f697b61157afc0912dd6b02bafbdcbd |