Personal font color utility library for Python
Project description
zyjared-color
安装
pip install zyjared-color
使用
from zyjared_color import color, blue, red
# 基本使用
content = color('Hello World!').red() + ' - test'
print(content.bold()) # content 可以继续调用
# 自由转换
text = f'{color("Hello World!").blue():<15} - test'
content = color(text).yellow()
print(content)
# 使用别名
print(blue('Hello World!'))
print(red('Hello World!').bold())
拓展
from zyjared_color import zprint
zprint([
'Hello',
'World!',
])
zprint({
'1': 'Hello World!',
'2': ['Hello World!'],
'3': {
'3-1!': 'Hello World!'
}
})
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.5.7.tar.gz
(9.4 kB
view details)
Built Distribution
File details
Details for the file zyjared_color-0.5.7.tar.gz
.
File metadata
- Download URL: zyjared_color-0.5.7.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad2ae4364fdaf755324806fb00f96fb69b6bbb471f431a5cbe585800d5b1ec1b |
|
MD5 | 79be2a9b5ad42c0745aecdf5c85c304c |
|
BLAKE2b-256 | 71937651b1d034729097abc663d9733597870d116ac7098216b1d4f98d04b348 |
File details
Details for the file zyjared_color-0.5.7-py3-none-any.whl
.
File metadata
- Download URL: zyjared_color-0.5.7-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb475d58658a7a2569ad6f9349d9b7d24f9b9bb6c645238b376b74c09c0a96e1 |
|
MD5 | 3a152e684459f9ec9e07e1573e193ca6 |
|
BLAKE2b-256 | 94a580722d5c53f080d83019cd52e044c63979da911afb61e335126aefbfec32 |