██████╗ ███████╗ ██████╗ ███╗ ██╗ ████████╗ ███████╗
██╔════╝ ██╔════╝ ██╔═══██╗ ████╗ ██║ ╚══██╔══╝ ██╔════╝
██║ █████╗ ██║ ██║ ██╔██╗ ██║ ██║ ███████╗
██║ ██╔══╝ ██║ ██║ ██║╚██╗██║ ██║ ╚════██║
╚██████╗ ██║ ╚██████╔╝ ██║ ╚████║ ██║ ███████║
╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝
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
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
argparseto drop dependencyclick. - 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.
Metadata
Release files for cfonts 1.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cfonts-1.5.2.tar.gz | 30.0 kB | Without provenance | Details for cfonts-1.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cfonts-1.5.2-py3-none-any.whl | Python 3 | none | any | Details for cfonts-1.5.2-py3-none-any.whl |
Total release size: 60.2 kB
Release files / cfonts-1.5.2.tar.gz
| Download URL | cfonts-1.5.2.tar.gz |
|---|---|
| Size | 30.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76e0a2004789df1f78fe5eb30f2841e82b6fc37215b14eb85a1663afd4800ab7
|
|
BLAKE2b-256 checksum How to use checksums |
e8f2e127a3b4c79a50b61489e891deb052a5aac8b9e1fedd14a38ab169c2ec53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.4
|
Release files / cfonts-1.5.2-py3-none-any.whl
| Download URL | cfonts-1.5.2-py3-none-any.whl |
|---|---|
| Size | 30.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8496fe765bbb374ea800703d34c785f6607c6bdd97d9d62bb23a89318ca2df1f
|
|
BLAKE2b-256 checksum How to use checksums |
5f1506968a5faea0a09d8617658ab872b5a31a3db1ec92ee1b2f8ebdcbcd2b74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.4
|
Security for cfonts 1.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.