跳转到主要内容

生成艺术 ASCII 文本

项目描述

xart 是一个纯 Python 库,提供了一种简单的方法来生成艺术 ASCII 文本。生命短暂,要酷。

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

### 入门

帮助

$ xart -h
usage: __init__.py [-h] [-f FONT] [-c COLOR] [-i] [-s] [-l] [-v]

xart : generate art ascii texts.

optional arguments:
  -h, --help            show this help message and exit
  -f FONT, --font FONT  font to render with, default random
  -c COLOR, --color COLOR
                        font color, default WHITE, all : BLACK, RED, GREEN,
                        YELLOW, BLUE, PURPLE, CYAN, GRAY, WHITE
  -i, --info            show information of given font
  -s, --show            show random fonts
  -l, --list            list all supported fonts
  -v, --version         version

通过随机字体生成 ASCII 文本

$ xart test
    ███        ▄████████    ▄████████     ███
▀█████████▄   ███    ███   ███    ███ ▀█████████▄
   ▀███▀▀██   ███    █▀    ███    █▀     ▀███▀▀██
    ███   ▀  ▄███▄▄▄       ███            ███   ▀
    ███     ▀▀███▀▀▀     ▀███████████     ███
    ███       ███    █▄           ███     ███
    ███       ███    ███    ▄█    ███     ███
   ▄████▀     ██████████  ▄████████▀     ▄████▀

通过给定字体生成 ASCII 文本

$ xart test -f 3D_Diagonal

    ___                                 ___
  ,--.'|_                             ,--.'|_
  |  | :,'                            |  | :,'
  :  : ' :               .--.--.      :  : ' :
.;__,'  /      ,---.    /  /    '   .;__,'  /
|  |   |      /     \  |  :  /`./   |  |   |
:__,'| :     /    /  | |  :  ;_     :__,'| :
  '  : |__  .    ' / |  \  \    `.    '  : |__
  |  | '.'| '   ;   /|   `----.   \   |  | '.'|
  ;  :    ; '   |  / |  /  /`--'  /   ;  :    ;
  |  ,   /  |   :    | '--'.     /    |  ,   /
   ---`-'    \   \  /    `--'---'      ---`-'
              `----'

通过给定颜色生成 ASCII 文本

COLOR

颜色

显示所有支持的字体

$ xart -l
xart : generate art ascii texts.

  0. 1Row
  1. 3-D
  ...
  277. Wow

All 278 fonts.

显示字体信息

$ xart -i -f Weird
weird.flf (version 2)
by:  Bas Meijer   meijer@info.win.tue.nl   bas@damek.kth.se
fixed by: Ryan Youck   youck@cs.uregina.ca
some special characters '#%*' etc. are not matching, they are from other fonts.
Explanation of first line:
flf2 - "magic number" for file identification
a    - should always be `a', for now
$    - the "hardblank" -- prints as a blank, but can't be smushed
6    - height of a character
5    - height of a character, not including descenders
20   - max line length (excluding comment lines) + a fudge factor
15   - default smushmode for this font (like "-m 15" on command line)
13   - number of comment lines

版本

$ xart -v
xart : generate art ascii fonts, version 0.1.5.
  ___      ____       ___
 / _ \    (___ \     / _ \
| | | |     __) )   | | | |
| | | |    / __/    | | | |
| |_| | _ | |___  _ | |_| |
 \___/ (_)|_____)(_) \___/

### 安装

xart 存放在 PYPI 上,可以按如下方式安装

$ pip install xart

或者,您也可以从 GitHub 获取最新源代码并手动安装

$ git clone git@github.com:xlzd/xart.git
$ cd xart
$ python setup.py install

更新

$ pip install xart --upgrade

### 许可证

WTFPL (在此)

项目详情


下载文件

下载您平台的文件。如果您不确定要选择哪个,请了解有关 安装包 的更多信息。

源代码发行版

xart-0.2.0.tar.gz (451.1 kB 查看哈希值)

源代码

支持