Dark mode for any PDF
Your reader app has dark mode; your PDFs don't care. They arrive as white pages that light up the room at midnight. recolor bakes the scheme into the file itself, so every viewer, tablet, and e-reader shows it, no plugin required.
How to do it
pip install "pdfblah[app]"
# dark mode: near-black paper, soft light ink
pdfblah recolor book.pdf -o book-dark.pdf
# warm sepia instead
pdfblah recolor book.pdf -o book-sepia.pdf --scheme sepia
# any ink color on white paper: the sheet-music move
pdfblah recolor score.pdf -o score-blue.pdf --scheme ink=navy
pdfblah recolor score.pdf -o score.pdf --scheme "ink=#204080"
What the schemes do
- dark: paper maps to near-black (#1E1E1E, deliberately not pure black; pure black halos on OLED), ink to soft light gray. A deterministic luminance map, so gradients and anti-aliasing survive.
- sepia: cream paper, warm brown ink; the paperback look.
- ink=COLOR: paper stays white, the marks take the color. Named colors (navy, blue, red, green, brown, gray) or any
#rrggbb. Built for the musician who wants scores printed in dark blue.
The honest trade-off
Like Clean scan, the output pages are
re-rendered images at your chosen --dpi (default 200). That is what makes the
scheme stick everywhere, and it costs the text layer; run
OCR afterwards if you want your dark-mode book
searchable again. Color originals are mapped through their brightness, so photos come
out monochrome in the scheme.
Tips
- For e-readers,
--dpi 150keeps files small; for print, stay at 200+. - Recolor a whole reading list with a batch recipe: one line, a folder of books.
- Gray, stained scans recolor better after a Clean scan pass makes the paper truly white first.