ANSI Formatted Text for Terminals.
Project description
ansiformat
ANSI Formatted Text for Terminals.
AnsiFormat for Custom Formatting
Colors
from zycelium.ansiformat import AnsiFormat
af = AnsiFormat()
print(af("Red text on default background").red)
print(af("Default text on lime background").on.lime)
print(af("Black text on yellow background").black.on.yellow)
print(af("Black text on cyan background").black.on.color("#00ffff"))
print(af("Red text on yellow background").color("#ff0000").on.color("#ffff00"))
Effects
from zycelium.ansiformat import AnsiFormat
af = AnsiFormat()
print(af("Bold").bold)
print(af("Dim").dim)
print(af("Italic").italic)
print(af("Underline").underline)
print(af("Blink").blink)
print(af("Inverse").inverse)
print(af("Hidden").hidden)
print(af("Strike").strike)
Using Colors and Effects Together
from zycelium.ansiformat import AnsiFormat
af = AnsiFormat()
print(af("Red text on default background, bold").red.bold)
print(af("Same, but with shortcut (b) for bold").red.b)
print(af("Same, but with shortcut (i) for italic").red.i)
print(af("Default text on lime background, with strike-through").on.lime.strike)
print(af("Black text on yellow background, underlined").black.on.yellow.underline)
print(af("Black text on cyan background, blinking").black.on.color("#00ffff").blink)
print(af("Red text on yellow background, inversed").color("#ff0000").on.color("#ffff00").inverse)
AnsiMarkup for Quick Formatting
from zycelium.ansiformat import AnsiMarkup, palette
m = AnsiMarkup(palette=palette.midnight_ablaze)
print(m.debug("debug"))
print(m.info("info"))
print(m.ok("ok"))
print(m.warning("warning"))
print(m.error("error"))
print(m.critical("critical"))
print(m.p("paragraph"))
print(m.aside("aside"))
print(m.note("note"))
print(m.alert("alert"))
print(m.h1("heading one"))
print(m.h2("heading two"))
print(m.h3("heading three"))
print(m.h4("heading four"))
print(m.h5("heading five"))
print(m.h6("heading six"))
with m.indent():
print(m.li("list item 1"))
print(m.li("list item 2"))
with m.indent():
print(m.li("list item 2.1"))
print(m.li("list item 2.2"))
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
Close
Hashes for zycelium.ansiformat-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 320bb309432750e25b1d6d261b5e8e8df83b89b7ce68f2ee87cbc2a1790883fe |
|
MD5 | 8e767a33f63c7b88770c157601dd6262 |
|
BLAKE2b-256 | fe4ebf64ccd3ac36a98261b4b0f96edb291bb21aca7d5596a14c1898e8ef0fd9 |
Close
Hashes for zycelium.ansiformat-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15de3598f37070c561cac49420d1f0f52bb1d8cf48ebd0f6834d720acf004e9c |
|
MD5 | caf372f22391f724b1456905bcafc8f1 |
|
BLAKE2b-256 | 52596c464d8d43cb071ccb3ac73e341599f22a86f4b69350142fc807c1fc8c13 |