Skip to main content

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 .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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

text_to_curses-0.1.0.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

text_to_curses-0.1.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

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

Hashes for text_to_curses-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7ce60a84e2f0e286c14af15c0c416f2b954d1c196f7320e7e4d3602866b831bc
MD5 b152da22b32ecce09d78239c27f48248
BLAKE2b-256 81122d3a7048db4291d7cfb7d2ca2b72978f13b6418642db58ebf6d585a905ab

See more details on using hashes here.

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

Hashes for text_to_curses-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65014427e0c9592065b51fba8435e1da0ff5db3555634aa93a35398547e48635
MD5 28d4751707b65973242a505ee467a885
BLAKE2b-256 766795a9de6a9cbb5c3db07a840be994e4546eaed9d54686d21b574a16f03b43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page