Skip to main content

Colorful Print 彩色文本格式化, 彩色文本输出, 控制打印字符颜色样式!

Project description

Colorful Print

彩色文本格式化, 彩色文本输出, 控制打印字符颜色样式!

main

安装

pip install -U cprint-jianjun

简介

让你的终端输出各式各样的彩色文本, 以一种非常简便的方式嵌入到程序中!

# default
print("{0}  {1}".format("Hello", "World!"))

# use cprint
import cprint
print("@56056{0}@45031{1}".cformat("Hello ", " World!"))

use

只需要在 {} 前加上@样式id, 然后把 format 改为 cformat 就可以按照样式id输出彩色文本

查看颜色样式ID

颜色样式ID为 @ 后面的数字, 安装完在命令行输入 cpshow 查看所有的样式id, 现在一共有 70943 个不同的样式可以选择, 不同的终端效果不一样, 有些终端可能不支持, 请自行测试.

style

其他命令行

  • cpshoww : 显示详细颜色信息
  • cpdemo : Hello World! 样例

固定常量

在字符串中使用 @NOW, @DATE, @TIME 可以获取到对应的时间字符串

print(" NOW: @NOW ".cformat())
print("DATE: @DATE ".cformat())
print("TIME: @TIME ".cformat())

实现方式

How to Print Colored Text in Python

how how

除了输出颜色字符外, 这种方式还可以控制光标、清屏的操作, 在其他语言如 c 下还有控制终端整体更改背景颜色类似的更高级的方法

更新记录

  • 20221116: 1.更新新的常量 @NOW, @DATE, @TIME 的功能 2.更新文档

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cprint-jianjun-1.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cprint_jianjun-1.1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file cprint-jianjun-1.1.0.tar.gz.

File metadata

  • Download URL: cprint-jianjun-1.1.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for cprint-jianjun-1.1.0.tar.gz
Algorithm Hash digest
SHA256 0c7e0d2f029940c5e0c4d5b99f08519ab916fc7d6fe16c2b76f4b9712773f65b
MD5 ef4b81146703358bc9590f8da9d34403
BLAKE2b-256 046332ea198cbf73c7f6c96b9a6d1f37af00fea404d93c606f8e75a499b16bfa

See more details on using hashes here.

File details

Details for the file cprint_jianjun-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: cprint_jianjun-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for cprint_jianjun-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82f2d3d1516a710166ee4f07d7a164673aaa961cd1747e92f52719e72999beae
MD5 72949113480a6dc28a04fadda9ac05d5
BLAKE2b-256 17733cbc15363b84a0197076a1b60c6079d3d24618bdc38f99ddbc6a3d1d867a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page