Takes control of terminal
Project description
Installation
pip install termspark
Usage
from termspark import TermSpark
TermSpark().print_right('RIGHT').spark()
TermSpark().spark_right('RIGHT').spark()
TermSpark().print_left('LEFT').spark()
TermSpark().spark_left('LEFT').spark()
TermSpark().print_center('CENTER').spark()
TermSpark().spark_center('CENTER').spark()
TermSpark().line('.').spark()
TermSpark().print_left('LEFT').print_right('RIGHT').set_separator('.').spark()
TermSpark().print_left('LEFT').print_center('CENTER').print_right('RIGHT').set_separator('.').spark()
TermSpark().spark_left('LEFT').spark_center('CENTER').spark_right('RIGHT').set_separator('.').spark()
Note Separator can contain only one character.
You can also paint your content
Supported colors:
- black
- red
- green
- yellow
- blue
- magenta
- cyan
- white
- gray / grey
- light red
- light green
- light yellow
- light blue
- light magenta
- light cyan
from termspark import TermSpark
TermSpark().print_right('RIGHT', 'blue').spark()
TermSpark().print_left('LEFT', 'light red').spark()
TermSpark().print_center('CENTER', 'light_green').spark()
Supported highlights:
- black
- red
- green
- yellow
- blue
- magenta
- cyan
- white
- gray / grey
- light red
- light green
- light yellow
- light blue
- light magenta
- light cyan
from termspark import TermSpark
TermSpark().print_right('RIGHT', None, 'light_magenta').spark()
TermSpark().print_left('LEFT', 'red', 'white').spark()
TermSpark().print_center('CENTER', 'white', 'light blue').spark()
You can use different styles on same position
from termspark import TermSpark
TermSpark().spark_left([' * ', 'gray', 'white'], [' Info ', 'white', 'blue']).spark()
TermSpark().spark_center([' * ', 'gray', 'white'], [' Warning ', 'white', 'yellow']).spark()
TermSpark().spark_right([' * ', 'gray', 'white'], [' Error ', 'white', 'red']).spark()
You know you can use them all together 😉
Lines are too long to write a termspark line! 😑
from termspark import TermSpark
TermSpark().spark_left([' * ', 'gray', 'white'], [' Info ', 'white', 'blue']).spark_center([' * ', 'gray', 'white'], [' Warning ', 'white', 'yellow']).spark_right([' * ', 'gray', 'white'], [' Error ', 'white', 'red']).spark()
You can separate them by calling each function in a line 🤤
from termspark import TermSpark
termspark = TermSpark()
termspark.spark_left([' * ', 'gray', 'white'], [' Info ', 'white', 'blue'])
termspark.spark_center([' * ', 'gray', 'white'], [' Warning ', 'white', 'yellow'])
termspark.spark_right([' * ', 'gray', 'white'], [' Error ', 'white', 'red'])
termspark.spark()
Still too long 🙄 Got you 🤩
from termspark import TermSpark
termspark = TermSpark()
termspark.spark_left([' * ', 'gray', 'white'])
termspark.spark_left(' Info ', 'white', 'blue')
termspark.spark_center([' * ', 'gray', 'white'])
termspark.spark_center([' Warning ', 'white', 'yellow'])
termspark.spark_right(' * ', 'gray', 'white')
termspark.spark_right([' Error ', 'white', 'red'])
termspark.spark()
Raw
You can print raw version which is colors-code-free so you can print clean text into files for example.
from termspark import TermSpark
raw = TermSpark().print_left('LEFT').print_right('RIGHT').set_separator('.').raw()
Force Width
You can customize width instead of the default full terminal width.
from termspark import TermSpark
TermSpark().set_width(40).print_left("LEFT", "red").print_right("RIGHT", "blue").spark()
Set content max width
You can specify max width of content depending on position using max_[position](max_characters)
.
from termspark import TermSpark
termspark = TermSpark()
termspark.spark_left(["LEFT", "red"])
termspark.spark_right(["RIGHT", "blue"])
termspark.max_left(2)
termspark.max_right(3)
termspark.spark()
This should show only "LE" on the left, and "RIG" on the right.
Warning
max_[position]()
is only supported by sparkers.
Full width
You can enable full width by using full_width()
.
from termspark import TermSpark
termspark = TermSpark()
termspark.spark_center(['Thanks for using Termspark!', 'white', 'green'])
termspark.full_width()
termspark.spark()
Warning
full_width()
can only be used with one position.
Separator
You can add color and highlight to separator too using set_separator(content, color, highlight)
.
termspark = TermSpark()
termspark.spark_left([' Author ', 'green'])
termspark.spark_right([' Faissal Wahabali ', 'green'])
termspark.set_separator('.', 'green')
termspark.spark()
Line
You can add highlight a line by using line(highlight=highlight)
.
termspark = TermSpark()
termspark.line(highlight='green')
termspark.spark()
Style
You can style your text by passing it to print() style parameter
or to spark([]) fourth list element
.
Supported styles:
- bold
- dim
- italic
- overline
- underline
- double underline
- strike through
- blink
- reverse
- hidden
Note You can mix styles by separating them by commas.
termspark = TermSpark()
termspark.print_center(' Termspark ', 'green', style='underline, overline, italic')
termspark.full_width()
termspark.spark()
Hyperlinks
You can insert hyperlink using Markdown [TEXT](LINK)
.
termspark = TermSpark()
termspark.spark_left([" Author ", "green"])
termspark.spark_right([" [@faissaloux](https://github.com/faissaloux) ", "green"])
termspark.set_separator(".", "green")
termspark.spark()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for termspark-1.7.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae8ef49f82af49831dc3b15588a212637b6c6f992c1e13c39f372fed09826ef8 |
|
MD5 | f58e9c0a62fb3653914667fee103b888 |
|
BLAKE2b-256 | 49d2a143fbf5c3acf2260f28a8e1c448a7602c600ed453fdac56418659ac443e |