A library for displaying documents in terminal with colors using curses
Project description
Text-to-Curses Print Library
A Python library for extracting text and color information from various document formats and displaying them in a terminal using curses with proper color formatting.
Features
- 🎨 Color extraction from documents (DOCX font colors, PDF text colors, HTML inline styles)
- 📄 Multi-format support: DOCX, PDF, HTML, RTF, TXT, MD
- 🖥️ Terminal display with proper curses color rendering
- 🔄 Reusable renderers - load once, display multiple times
- 📦 Simple API - just a few lines of code to get started
Installation
pip install text-to-curses
Quick Start
from text_to_curses import display_document
# Simple one-liner
display_document("document.docx")
Advanced Usage
from text_to_curses import TextRenderer
import curses
# Load document once, display multiple times
renderer = TextRenderer("document.docx")
def custom_display(stdscr):
renderer.display(stdscr)
stdscr.addstr(0, 0, "Press any key to exit", curses.A_REVERSE)
stdscr.refresh()
stdscr.getch()
curses.wrapper(custom_display)
Command Line Usage
text-to-curses document.docx
Supported Formats
| Format | Extension | Color Support | Notes |
|---|---|---|---|
| Word | .docx |
✅ Font colors, highlights | Best color support |
.pdf |
✅ Text colors | Limited background colors | |
| HTML | .html, .htm |
✅ Inline CSS | color and background-color |
| RTF | .rtf |
❌ Plain text only | RTF codes stripped |
| Text | .txt |
❌ Plain text only | Default colors |
| Markdown | .md |
❌ Plain text only | Formatting stripped |
Examples
See the examples/ directory for more usage examples:
- Basic document viewer
- Multi-document slideshow
- Custom display functions
Development
git clone https://github.com/yourusername/Text-to-Curses-print.git
cd Text-to-Curses-print
pip install -e .
License
MIT License - see LICENSE file for details.
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 text_to_curses-0.1.0.tar.gz.
File metadata
- Download URL: text_to_curses-0.1.0.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ce60a84e2f0e286c14af15c0c416f2b954d1c196f7320e7e4d3602866b831bc
|
|
| MD5 |
b152da22b32ecce09d78239c27f48248
|
|
| BLAKE2b-256 |
81122d3a7048db4291d7cfb7d2ca2b72978f13b6418642db58ebf6d585a905ab
|
File details
Details for the file text_to_curses-0.1.0-py3-none-any.whl.
File metadata
- Download URL: text_to_curses-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65014427e0c9592065b51fba8435e1da0ff5db3555634aa93a35398547e48635
|
|
| MD5 |
28d4751707b65973242a505ee467a885
|
|
| BLAKE2b-256 |
766795a9de6a9cbb5c3db07a840be994e4546eaed9d54686d21b574a16f03b43
|