Skip to main content

Sexy fonts for the console

Project description

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

Tests

This is a Python port of cfonts. Thanks for the original code and beautiful console fonts!

NOTE: This project supports Python 3.6+

Installation

$ pip install python-cfonts

Usage

Documentation

Command line interface:

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.

Or generate the fonts pragramatically:

from cfonts import render, say

output = render('Hello world', colors=['red', 'yellow'], align='center')
print(output)

Supported Characters

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 _ _ `` (space)
"

Contributing

python-cfonts is managed by pdm, first install it:

pipx install pdm

Then, install a dependencies:

pdm install -d

Run tests:

$ pdm run pytest tests

License

The project is originated by @dominikwilkowski, under GPLv2 license. Ported by @frostming, under MIT license. See LICENSE for details

Changelog

  • v1.5.2 Fix the RGB color codes for truecolor system.
  • v1.5.1
    • Fix the truecolor display on Windows.
    • Enable truecolor by default for Windows Terminal.
    • Add type hints for the codebase.
  • v1.5.0 Officially drop support of Python 2.7
  • v1.4.0 Officially drop support of Python 3.5
  • v1.3.1 Fix the sdist.
  • v1.3.0 Relicense to MIT.
  • v1.2.0 Add font tiny.
  • v1.1.0 Switch to argparse to drop dependency click.
  • v1.0.0 Support gradient colors and transition gradient.
  • v0.5.0 Add four new fonts and double quote as supported charater.
  • v0.3.1 Fix a bug that the background doesn't span the full width.
  • v0.3.0 Supports Python 2.7.
  • v0.2.0 Initial commit and testing.

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

python-cfonts-1.5.2.tar.gz (29.6 kB view details)

Uploaded Source

Built Distribution

python_cfonts-1.5.2-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

Details for the file python-cfonts-1.5.2.tar.gz.

File metadata

  • Download URL: python-cfonts-1.5.2.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for python-cfonts-1.5.2.tar.gz
Algorithm Hash digest
SHA256 85588e71003c7db986afaaa65755bad034c9f10ed29b32c5f2dc18ce9d77c030
MD5 2b3f4a4f16907f182ff57e1a5a0a0784
BLAKE2b-256 ca072c006c9a98e103dd1dbdc192966ae460a7dc8058cbeac658db67afeda425

See more details on using hashes here.

File details

Details for the file python_cfonts-1.5.2-py3-none-any.whl.

File metadata

  • Download URL: python_cfonts-1.5.2-py3-none-any.whl
  • Upload date:
  • Size: 29.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for python_cfonts-1.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 88ddfffae675a2bc4e796baf057c5b989541a710bef4ac3e739edfbb388027ed
MD5 a2ea81e72084c3a90e1b2d25c3734f62
BLAKE2b-256 c4e03b1c9b17f561b8c6d04ce97ecf84bf3c80073a9369f1da7e71da0bd79e7b

See more details on using hashes here.

Supported by

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