CFonts: Sexy fonts for the console¶
This is a Python port of @dominikwilkowski’s cfonts. Thanks for the original code and beautiful console fonts!
This project supports Python 2.7+ and 3.5+
Installation¶
Recommended way: use pipx:
$ pipx install python-cfonts
Or alternatively, install using Pip:
$ pip install python-cfonts
Command Line Interface¶
cfonts¶
This is a tool for sexy fonts in the console. Give your cli some love.
cfonts [OPTIONS] TEXT
Options
-
-f
,
--font
<font>
¶ Use to define the font face
-
-c
,
--colors
<colors>
¶ Use to define the font color
-
-b
,
--background
<background>
¶ Use to define the background color
-
-a
,
--align
<align>
¶ Use to align your text output
-
-l
,
--letter-spacing
<letter_spacing>
¶ Use to define your letter spacing
-
-z
,
--line-height
<line_height>
¶ Use to define your line height
-
-s
,
--spaceless
¶
Use to disable the padding around your output
-
-m
,
--max-length
<max_length>
¶ Use to define the amount of maximum characters per line
-
-g
,
--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.
-
-V
,
--version
¶
Show the version and exit.
Arguments
-
TEXT
¶
Required argument
Examples¶
API References¶
-
cfonts.
render
(text, font='block', size=(80, 24), colors=None, background='transparent', align='left', letter_spacing=None, line_height=1, space=True, max_length=0, gradient=None, independent_gradient=False, transition=False)¶ Main function to get the colored output for a string.
Parameters: - text – the string you want to render
- font – use to define the font
- size – a (width, height) tuple to define the window size
- colors – a list of color names to render sequentially
- background – background color name
- align – the alignment method: left/center/right
- letter_spacing – the amount of spacing inserted between letters
- line_height – the height of each line
- space – whether to wrap the output with blank lines
- max_length – define the max length of per line, use 0 to disable
- gradient – define the gradient color sequence
- independent_gradient – whether to apply gradient to each line independently
- transition – If set to True, will generate transition gradient colors
Returns: the colored output string
-
cfonts.
say
(text, **options)¶ Render and write the output to stout.
Parameters: - text – the string you want to render
- options – options passed as same as
cfonts.render()
Returns: None