Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pdf2dark

Convert PDFs to dark mode for comfortable night reading.

The only PDF inverter that keeps your text searchable.

Why pdf2dark?

Other tools (darkpdf, pdfinverter, invert-pdf) just flip colors and destroy text selectability. pdf2dark uses OCR to rebuild a searchable text layer.

Feature Others pdf2dark
Dark mode conversion Yes Yes
Text searchable No Yes
Text selectable/copyable No Yes
Preserves page dimensions Some Yes
Simple CLI Varies Yes

Installation

Requirements: Python 3.8+, Tesseract OCR

# macOS
brew install tesseract

# Ubuntu/Debian
sudo apt install tesseract-ocr

# Clone and setup
git clone https://github.com/redLocomotive/pdf2dark.git
cd pdf2dark
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
chmod +x pdf2dark

Usage

./pdf2dark input.pdf

Output: input_DARK.pdf (or input_DARK_1.pdf if exists)

How it works

  1. Renders each PDF page as a high-resolution image
  2. Inverts colors (white → black, black → white)
  3. Runs OCR to extract text and positions
  4. Creates new PDF with inverted image + invisible searchable text layer

The invisible text layer means you can still:

  • Search for text (Cmd/Ctrl+F)
  • Select and copy text
  • Use screen readers

Limitations

  • Output file is larger than original (~10-20x for vector PDFs)
  • Photos/images get inverted too
  • OCR accuracy depends on source quality

License

MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages