Effortlessly spice up your terminal apps using colors, progressbars & more
Project description
Revel
revel helps you create beautiful interfaces for your command line tools. Best
of all, it's extremely easy to use.
Simply replace the standard print function with revel's and just like that you
can now display colors!
from revel import print
print('[green]Hello, World![/]')
Styles
revel uses BBCode-style markup to style your text. A variety of styles
are available:
-
Formatting:
- bold
- dim
- italic
- underlined
- inverted
- strikethrough
-
Text Colors:
- black
- red
- green
- blue
- magenta
- cyan
- white
-
Background Colors:
- bg-black
- bg-red
- bg-green
- bg-blue
- bg-magenta
- bg-cyan
- bg-white
Adding weak to a tag will only apply the styles of that tag, if no competing styles are already applied. For example:
print("[red]Hello, [weak blue underlined]World![/][/]")
This will be displayed entirely in red (since the weak "blue" formatting is overridden by "red"), but the "underlined" formatting will still be applied.
Progressbars
Adding progressbars is easy as can be:
from revel import print, ProgressBar
import time
with ProgressBar(max=10, unit="percent") as bar:
for ii in range(10):
bar.progress = ii
time.sleep(1.0)
You can switch units between "count", "percent", "byte" and "time". The bar will also automatically display how much time remains until completion, once it is confident in its estimate.
Edit text after it has already been printed
Docked widgets can be edited at will. For example, this example docks a text line and updates it repeatedly:
from revel import print
import time
line = print("Looking for files", dock=True)
for ii in range(1, 10):
line.text = f"Found {ii} file(s)"
time.sleep(1.0)
Additional print-like methods
In addition to print, revel also provides success, warning, error and
fatal. These will be displayed in color, drawing attention to the message.
TODO
- Implement the
verbatimtag - Jupyter Notebook support
- Test on bad terminals
- Actual docs
- Showcase features:
print_chapterselectselect_multipleselect_shortselect_yes_no
input_keyinput- general improvements, such as parsing, default
- secret input
escapeunescape
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file revel-0.9.2.post1.tar.gz.
File metadata
- Download URL: revel-0.9.2.post1.tar.gz
- Upload date:
- Size: 30.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ad9763aadb71abac80153ea8c7463f425b69f3b9517171825d6e37a4368ca48
|
|
| MD5 |
0f86e1528b5aff14c9d4af09fbcab814
|
|
| BLAKE2b-256 |
807cba764c68bc5562bab4980cb25bf4b69aff6001c57aec4de9db37f53466b1
|
File details
Details for the file revel-0.9.2.post1-py3-none-any.whl.
File metadata
- Download URL: revel-0.9.2.post1-py3-none-any.whl
- Upload date:
- Size: 33.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a67c34ac2122871beb18a40709e7957f34e59cf76160936fc9bef49fe7c0b255
|
|
| MD5 |
59c5402037c469bb1b6b9399cdf3a48d
|
|
| BLAKE2b-256 |
2a3ba21f424cd2e3697b4cbf758f6bf649c6097cbc4c37b0b512e2adf37a5047
|