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())
拓展
zprint
需要使用 print
打印列表或者字典时可以使用。
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.9.tar.gz
(9.5 kB
view details)
Built Distribution
File details
Details for the file zyjared_color-0.5.9.tar.gz
.
File metadata
- Download URL: zyjared_color-0.5.9.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d89984b960895d93a07f630a60ab31e7c3aaf1483148213c10b61e39b318945a |
|
MD5 | 2054b5374950c388fa9036aa751342c6 |
|
BLAKE2b-256 | 3b67f5c6085dd7f3b9b88fd61b4bf6aa084ccbd22463f7543d2a84ea411685e3 |
File details
Details for the file zyjared_color-0.5.9-py3-none-any.whl
.
File metadata
- Download URL: zyjared_color-0.5.9-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8eb576b9965de78ca0c29e7356746c718ea0b45d01ae686e7d07a2fef4b7e37 |
|
MD5 | 27ed33f14d9449ae8e335b8b2ef5c92b |
|
BLAKE2b-256 | 58b7693140a80fa4d64c0bafb93bd90ba7894356505b8c8b929f76bff8d4a282 |