跳转到主要内容

控制台性感字体

项目描述

  ██████╗ ███████╗  ██████╗  ███╗   ██╗ ████████╗ ███████╗
 ██╔════╝ ██╔════╝ ██╔═══██╗ ████╗  ██║ ╚══██╔══╝ ██╔════╝
 ██║      █████╗   ██║   ██║ ██╔██╗ ██║    ██║    ███████╗
 ██║      ██╔══╝   ██║   ██║ ██║╚██╗██║    ██║    ╚════██║
 ╚██████╗ ██║      ╚██████╔╝ ██║ ╚████║    ██║    ███████║
  ╚═════╝ ╚═╝       ╚═════╝  ╚═╝  ╚═══╝    ╚═╝    ╚══════╝

Tests

这是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-cfontspdm管理,首先安装它

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 3

支持者