I built PDF Dark — convert any PDF to true dark mode, 100% in your browser

javascript dev.to

Why another PDF tool?

I read a lot of PDFs at night — research papers, ebooks, technical manuals. Every PDF reader I tried had the same problem: their "dark mode" was just a viewer toggle. The moment I forwarded the PDF to my Kindle or iPad, the white background blasted me again.

So I built PDF Dark — a tool that converts any PDF into a real dark-mode PDF file you can download, share, and reread anywhere.

What it does

  • 100% browser-side conversion. Your file never touches a server. Verifiable in DevTools.
  • Real dark output PDF, not a viewer trick. Works on Kindle, iPad, Acrobat, anywhere.
  • Saturation-aware algorithm — photos and charts keep their original colors.
  • Free, MIT-licensed, no signup, no ads.

How it works under the hood

The conversion runs entirely in the browser using PDF.js to parse the original PDF page by page, then re-renders each page through a Canvas pipeline. The algorithm walks pixel data and inverts only low-saturation regions (text, line art, white background), while preserving high-saturation regions (photos, color charts, logos).

The output is then re-encoded as a standard PDF using pdf-lib. No server, no upload — your file never leaves your device.

Try it

Feedback welcome

This is an early version. PRs, bug reports, and feature requests are very welcome — especially edge cases (complex form PDFs, scanned PDFs with dense images, RTL languages). Drop a comment below or open an issue on GitHub.

If you read PDFs at night, give it a try and let me know what breaks.

Source: dev.to

arrow_back Back to Tutorials