Render Markup to Terminal.
Inspired by tml.
Pros:
- Faster than alternatvies like
rich. - Supports background colors and hex.
- Null-dependency.
Install:
pip install terminal-markup
poetry add terminal-markupAfter install you can use command terminal-markup.
from terminal_markup import render
# let's render bricks
print(render("[b][color=#f70000 background=yellow] WARNING [/color]:[/b] [purple]Life leads to [i blue underline]Death[/i].[/purple]"))| Tag | Description |
|---|---|
b, bold |
Bold text |
i, em |
Italic text |
u |
Underline text |
blink |
-- |
dim |
Dimmed color |
rev |
Reversed foreground and background colors |
[color=<color>], <color name> |
Set foreground color |
Non-existent tags do not cause errors.
| Attribute | Description |
|---|---|
<color name>, color=<color> |
Set foreground color |
background=<color> |
Set background color |
{bold|italic|underline|dim|reversed|blink}[={no|off|false|0|...}] |
Set style |
Unknown attributes are ignored.
Color names: black, maroon, green, olive, navy, purple, teal, silver, grey, red, lime, yellow, blue, fuchsia, aqua, white (first 16 colors from here). Also supported HEX-codes like #87CEEB.
\[- escaped[.
Tag names, attributes and color names are case insensetive.