Colorful Print 彩色文本格式化, 彩色文本输出, 控制打印字符颜色样式!
Project description
Colorful Print
彩色文本格式化, 彩色文本输出, 控制打印字符颜色样式!
安装
pip install -U cprint-jianjun
简介
让你的终端输出各式各样的彩色文本, 以一种非常简便的方式嵌入到程序中!
# default
print("{0} {1}".format("Hello", "World!"))
# use cprint
import cprint
print("@56056{0}@45031{1}".cformat("Hello ", " World!"))
只需要在 {} 前加上@样式id, 然后把 format 改为 cformat 就可以按照样式id输出彩色文本
查看颜色样式ID
颜色样式ID为 @ 后面的数字, 安装完在命令行输入 cpshow 查看所有的样式id, 现在一共有 70943 个不同的样式可以选择, 不同的终端效果不一样, 有些终端可能不支持, 请自行测试.
其他命令行
cpshoww: 显示详细颜色信息cpdemo: Hello World! 样例
固定常量
在字符串中使用 @NOW, @DATE, @TIME 配合 cformatd 函数可以获取到对应的时间字符串
print(" NOW: @NOW ".cformatd())
print("DATE: @DATE ".cformatd())
print("TIME: @TIME ".cformatd())
实现方式
How to Print Colored Text in Python
除了输出颜色字符外, 这种方式还可以控制光标、清屏的操作, 在其他语言如 c 下还有控制终端整体更改背景颜色类似的更高级的方法
更新记录
- 20221116: 1.更新新的常量
@NOW,@DATE,@TIME的功能 2.更新文档
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 cprint-jianjun-1.0.0.tar.gz.
File metadata
- Download URL: cprint-jianjun-1.0.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c43d2413f45273e985e24e0bbbdd96e6458eede7ab1b6ff8cba6cedc8865747
|
|
| MD5 |
8da40d405447d4f63334c6542b2a7c9a
|
|
| BLAKE2b-256 |
3a6804142f7ecb8428af40451ab43864ebed04268aafdf79800830667b156502
|
File details
Details for the file cprint_jianjun-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cprint_jianjun-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a4e30d791eebfe5b44cec487376c6852a7fc226254e0772bc1bec4a8b1b7f3f
|
|
| MD5 |
d8ac269c1955a8ea914fa682a40ecac9
|
|
| BLAKE2b-256 |
0224175f3ee86b8df8273c94bd649410f656a2216e05e8e0a224a79b4f905e6d
|