Skip to content
Vasu021Public

About

Read PDFs in soft, low-glare colors. A single-file, zero-dependency PDF reader with three calm reading themes and hue-preserving dark mode.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

Repository files navigation

🪔 Lamplight

A one-page PDF reader that redraws papers in calm, low-glare colours.

License: MIT No build step Zero dependencies

Lamplight reading a paper in the Dusk theme

Dusk Moss Parchment
Dusk theme Moss theme Parchment theme
Slate charcoal Dark green-grey Warm sepia

Open as many papers as you like and switch between them from the toolbar:

The document switcher, listing three open papers

Come back later and your shelf is waiting, with your place in each paper:

The shelf on the front page, listing three papers with reading progress

Why

Reading white-background PDFs on a screen — in a viewer, in VS Code, anywhere — is a small floodlight pointed at your face, and after a few papers it shows. Lamplight opens a PDF locally and re-renders every page in a quieter palette, so a long reading session stops being a squinting match. Figures keep their colours and the text stays selectable, so nothing is lost in the trade.

Features

  • Open anything — file picker, or drop PDFs anywhere on the page.
  • Or paste a link — give Lamplight the address of a PDF and it fetches the paper, names it by its own title rather than its id, and puts it on your shelf like anything else. Works wherever the site lets other pages read its files; arxiv does.
  • Many documents at once — open a stack of papers and switch between them from the toolbar. Each one remembers where you were reading.
  • A shelf that survives closing the tab — documents you open are kept in this browser, with your place in each. Come back tomorrow, pick one, and carry on from the page you stopped at. Remove any of them in one click.
  • Three reading themes — Dusk (slate charcoal), Moss (dark green-grey), Parchment (warm sepia).
  • Smart invert — on dark themes, lightness is flipped but hue is preserved, so a blue bar in a chart stays blue.
  • Text stays text — selectable and copyable via the pdf.js text layer, with a theme-coloured selection highlight.
  • Fast on long documents — pages render lazily as you scroll, sharp on HiDPI screens.
  • Zoom 50–300% — from the toolbar or with Ctrl/⌘ + and −.
  • Jump to any page — the page counter is editable: click it, type a number, press Enter. No scrolling through a hundred pages to reach page 94.
  • Remembers you — theme, zoom and your place in every document persist between visits.
  • Private by design — the file is read in your browser and never uploaded anywhere.
  • Considerate — friendly errors, visible keyboard focus, responsive layout, respects prefers-reduced-motion.

How to use

Online: https://lamplight.ink/ — also reachable at https://vasu021.github.io/Lamplight/, which redirects there.

Locally: download index.html and open it in your browser. That's the whole install — there is nothing to build and nothing to npm install.

Then choose a PDF or drag one onto the window — drop several at once if you like — and pick a theme from the toolbar at the bottom.

Or paste a link. Under the drop zone is a box for the address of a PDF: paste https://arxiv.org/pdf/2409.10986, press Enter, and the paper opens here. The abstract page (/abs/) works too, and so does the bare id. Lamplight reads the title off the paper itself, so your shelf says Attention Is All You Need rather than 1706.03762. You can also just paste a link onto the page while you are reading, or drag one in from another tab, and Open a link… in the switcher brings you back to the box. A fetched paper goes on your shelf with the rest, so pasting the same link tomorrow opens it from this browser rather than downloading it again.

Not every site allows this. A PDF can only be fetched by another page if its server says so, and while arxiv does, many publishers don't. When one refuses, Lamplight says so and offers to open the link in a new tab, so you can save the file and drop it in.

Your shelf at the foot of the switcher takes you back to the front page at any time, without closing anything — the documents stay loaded, so stepping back in puts you exactly where you were. A lamp-coloured dot marks the ones still open.

Everything you open goes on your shelf, which is waiting on the front page next time you visit — each document with the page you reached and a line showing how far in you are. Click one to carry on where you stopped, or press its × to remove it. The list keeps to a fixed height and scrolls once it fills, so forty papers leave the front page as short as three do. Nothing is opened for you automatically; the shelf is a list to choose from, not a session to restore.

To go straight to a page, click the page counter in the middle of the toolbar, type the number and press Enter — numbers outside the document are clamped to its first or last page, so a mistyped 999 lands on the end rather than doing nothing.

With more than one document open, the filename on the left of the toolbar becomes a switcher: it shows how many are open, and clicking it lists them. Pick one to jump to it, press × to close it, Open a PDF… to add another, or Your shelf to step back to the front page. Opening a file you already have open just takes you back to it rather than loading a second copy.

Keyboard shortcuts

Keys Action
Ctrl/⌘ + + Zoom in
Ctrl/⌘ + − Zoom out
Enter (in the page counter) Jump to the page you typed
↑ ↓ (in the page counter) Step forward / back one page
Esc (in the page counter) Cancel and go back to the current page
Alt/⌥ + 1…9 Jump to the nth open document
Alt/⌥ + ← → Previous / next document (wraps)
Esc Close the document switcher, or stop a link that's being fetched
Tab Move through the toolbar controls
Space, ↑ ↓, Page Up/Down Scroll the document (ordinary browser scrolling)

The document shortcuts use Alt/⌥ rather than Ctrl/⌘ because ⌘Tab and ⌘W belong to the browser and the operating system.

How it works

pdf.js renders each page to a canvas, and Lamplight then rewrites the pixels before they reach your eyes.

On the dark themes this is a smart invert rather than a plain one. For each pixel it computes

k = 255 − max(r, g, b) − min(r, g, b)

and adds k to all three channels. That flips lightness while leaving the relationship between channels — the hue — intact, which is why charts and figures survive the trip. The result is then mapped linearly onto the theme's background→text colour range, so nothing lands on pure black or pure white; the Parchment theme uses the same mapping without the inversion.

Pages are observed with an IntersectionObserver and rendered just before they scroll into view, at devicePixelRatio (capped at 2.5) for crispness, and fit to the window width up to 900px.

Every open document keeps its own page list, observer and scroll position; only the active one is in the layout, so the documents you aren't reading cost nothing to keep around. Changing theme or zoom marks all of them stale at once, and each re-renders lazily the next time you look at it.

The shelf uses two IndexedDB stores rather than one: the PDF bytes in files, the name, page count and your place in meta. They are separate so that remembering a page number never has to rewrite a forty-megabyte blob.

Privacy

Your PDFs never leave your machine. They are read with the browser's File API, decoded in the tab, and drawn to a canvas — there is no server, no upload, no analytics. Apart from a link you paste yourself, the only network requests Lamplight makes are for pdf.js and the Literata font, both from public CDNs, the first time you load the page.

When you do paste a link, your browser asks that address for the file directly, the way it would if you opened the link yourself. There is no relay, proxy or third party in the middle — which is the reason a site that refuses gets an explanation rather than a way around it — and the paper that comes back is kept on your device like any other.

The shelf keeps its copies in IndexedDB, which is browser storage on your own device, scoped to this one site. Nothing is synced and nothing is sent anywhere — opening Lamplight on another machine gives you an empty shelf. Removing a document deletes Lamplight's copy immediately; your original file on disk is never touched either way. Clearing site data for the page empties the shelf too.

Limitations

  • Scanned (image-only) PDFs have no selectable text — they recolour fine, but there is nothing to select.
  • Very large PDFs recolour page by page as you scroll, so expect a brief pause on each new page.
  • The first load needs an internet connection to fetch pdf.js and the font.
  • Open documents live in memory for the session. A dozen large PDFs at once will use a lot of it, and closing a document is what gives it back.
  • The shelf stores a copy of each PDF, so it counts against the browser's storage quota for this site. When there is no room left Lamplight says so and keeps reading — remove something from the shelf to make space.
  • The shelf is per browser and per device. It does not follow you to another machine, and clearing site data empties it.
  • A pasted link only works if the site allows other pages to read its files. arxiv.org does; ACL Anthology, NeurIPS proceedings, PLOS and OpenReview, among others, do not — for those, open the link in a new tab, save the PDF and drop it in.
  • Papers built with LaTeX usually carry no title of their own, so Lamplight takes the title from the top of the first page. A scanned paper has no text to read there and keeps the name from its address.

Roadmap

  • Custom theme colours
  • Offline / PWA support
  • Search within the document, and across the shelf
  • Bookmarks and notes within a document

Contributing

Ideas, bug reports and small patches are all welcome — see CONTRIBUTING.md.

License

MIT.

Acknowledgements

  • pdf.js by Mozilla (Apache-2.0) does all the hard work of decoding PDFs.
  • Literata by Google Fonts, a typeface designed for long-form reading.

About

Read PDFs in soft, low-glare colors. A single-file, zero-dependency PDF reader with three calm reading themes and hue-preserving dark mode.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages