https://github.com/technige/pansi
Text mode rendering library
https://github.com/technige/pansi
Last synced: 4 months ago
JSON representation
Text mode rendering library
- Host: GitHub
- URL: https://github.com/technige/pansi
- Owner: technige
- License: apache-2.0
- Created: 2020-07-01T17:37:33.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-11-17T23:58:42.000Z (over 1 year ago)
- Last Synced: 2025-03-20T19:47:00.043Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 4.63 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pansi
Pansi is a text mode rendering library. It provides a clean and simple
interface for working with text and graphics in the terminal, using ANSI escape
sequences for rendering. The library provides the following modules:
- `pansi.text` -- text colouring and styling
- `pansi.image` -- terminal-based image rendering
- `pansi.screen` -- full screen layout handling
Most modern terminals support ANSI rendering, but the exact feature sets
available do vary. Bear in mind that not every listed function might work in
every terminal, and check the documentation for your terminal software to make
sure.
## `pansi.text`
The `pansi.text` module provides a suite of functions for colouring and styling
terminal text, using ANSI escape sequences. Functions are designed to align as
closely as possible to CSS rules and properties, for ease of use.
### Colours
Let's start with something simple. The following example will render the word
"world" in green:
>>> from pansi.text import green
>>> print(f"Hello, {green}world{~green}!")
Hello, world!