控制台性感字体
项目描述
██████╗ ███████╗ ██████╗ ███╗ ██╗ ████████╗ ███████╗
██╔════╝ ██╔════╝ ██╔═══██╗ ████╗ ██║ ╚══██╔══╝ ██╔════╝
██║ █████╗ ██║ ██║ ██╔██╗ ██║ ██║ ███████╗
██║ ██╔══╝ ██║ ██║ ██║╚██╗██║ ██║ ╚════██║
╚██████╗ ██║ ╚██████╔╝ ██║ ╚████║ ██║ ███████║
╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝
这是cfonts的Python移植版本。感谢原始代码和美丽的控制台字体!
注意: 此项目支持Python 3.6+
安装
$ pip install python-cfonts
使用
命令行界面
usage: cfonts [-h] [-V]
[-f {console,block,simpleBlock,simple,3d,simple3d,chrome,huge,grid,pallet,shade,slick}]
[-c COLORS] [-b BACKGROUND] [-a {left,center,right}]
[-l LETTER_SPACING] [-z LINE_HEIGHT] [-s] [-m MAX_LENGTH]
[-g GRADIENT] [-i] [-t]
text
positional arguments:
text
optional arguments:
-h, --help show this help message and exit
-V, --version show program's version number and exit
-f {console,block,simpleBlock,simple,3d,simple3d,chrome,huge,grid,pallet,shade,slick}, --font {console,block,simpleBlock,simple,3d,simple3d,chrome,huge,grid,pallet,shade,slick}
Use to define the font face
-c COLORS, --colors COLORS
Use to define the font color
-b BACKGROUND, --background BACKGROUND
Use to define the background color
-a {left,center,right}, --align {left,center,right}
Use to align the text output
-l LETTER_SPACING, --letter-spacing LETTER_SPACING
Use to define the letter spacing
-z LINE_HEIGHT, --line-height LINE_HEIGHT
Use to define the line height
-s, --spaceless Use to define the background color
-m MAX_LENGTH, --max-length MAX_LENGTH
Use to define the amount of maximum characters per
line
-g GRADIENT, --gradient GRADIENT
Define gradient colors(separated by comma)
-i, --independent-gradient
Set this option to re-calculate the gradient colors
for each new line.Only works in combination with the
gradient option.
-t, --transition-gradient
Set this option to generate your own gradients. Each
color set in the gradient option will then be
transitioned to directly.
或者通过编程方式生成字体
from cfonts import render, say
output = render('Hello world', colors=['red', 'yellow'], align='center')
print(output)
支持字符
A |
O |
2 |
2 |
= |
B |
P |
3 |
3 |
@ |
C |
Q |
4 |
4 |
# |
D |
R |
5 |
5 |
$ |
E |
S |
6 |
6 |
% |
F |
T |
7 |
7 |
& |
G |
U |
8 |
8 |
( |
H |
V |
9 |
9 |
) |
I |
W |
! |
! |
/ |
J |
X |
? |
? |
: |
K |
Y |
. |
. |
; |
L |
Z |
+ |
+ |
, |
M |
0 |
- |
- |
' |
N |
1 |
_ |
_ |
`` (空格) |
" |
贡献
python-cfonts
由pdm管理,首先安装它
pipx install pdm
然后,安装依赖项
pdm install -d
运行测试
$ pdm run pytest tests
许可证
该项目由@dominikwilkowski创建,采用GPLv2许可证。由@frostming移植,采用MIT许可证。有关详情请参阅LICENSE
变更日志
- v1.5.2 修复了truecolor系统的RGB颜色代码。
- v1.5.1
- 修复了Windows上的truecolor显示。
- 默认启用Windows Terminal的truecolor。
- 为代码库添加类型提示。
- v1.5.0 正式放弃对Python 2.7的支持
- v1.4.0 正式放弃对Python 3.5的支持
- v1.3.1 修复了sdist。
- v1.3.0 重新许可为MIT。
- v1.2.0 添加字体
tiny
。 - 版本1.1.0 切换到
argparse
以去除对click
的依赖。 - 版本1.0.0 支持渐变色和渐变过渡。
- 版本0.5.0 添加四种新字体,并支持双引号作为有效字符。
- 版本0.3.1 修复了背景无法全宽显示的bug。
- 版本0.3.0 支持 Python 2.7。
- 版本0.2.0 初始提交和测试。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。
源分发
python-cfonts-1.5.2.tar.gz (29.6 kB 查看哈希值)
构建分发
python_cfonts-1.5.2-py3-none-any.whl (29.9 kB 查看哈希值)
关闭
python-cfonts-1.5.2.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 85588e71003c7db986afaaa65755bad034c9f10ed29b32c5f2dc18ce9d77c030 |
|
MD5 | 2b3f4a4f16907f182ff57e1a5a0a0784 |
|
BLAKE2b-256 | ca072c006c9a98e103dd1dbdc192966ae460a7dc8058cbeac658db67afeda425 |
关闭
python_cfonts-1.5.2-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 88ddfffae675a2bc4e796baf057c5b989541a710bef4ac3e739edfbb388027ed |
|
MD5 | a2ea81e72084c3a90e1b2d25c3734f62 |
|
BLAKE2b-256 | c4e03b1c9b17f561b8c6d04ce97ecf84bf3c80073a9369f1da7e71da0bd79e7b |