allefeld / atom-pdfjs-viewer

Themed, fully featured PDF viewer for the Atom editor
MIT License
12 stars 3 forks source link

add an option to invert the colors #4

Closed YtvwlD closed 2 years ago

YtvwlD commented 4 years ago

I have a dark UI and syntax theme configured in Atom but most of the PDFs I look at are mostly white. It would be great if I could invert the displayed colors.

allefeld commented 4 years ago

My Atom package is just a wrapper for the pdf.js library and viewer. It was relatively easy to adapt the UI components to the current Atom theme, but to do the same for the PDF display itself would mean to go deeply into this quite complex software, which I'm afraid is beyond my abilities.

If you create the PDFs yourself, as a workaround you could create them with a dark background and light text, e.g. in LaTeX with the xcolor package.

If not, you could submit a feature request on their repository, pdf.js.

YtvwlD commented 4 years ago

Ah, okay. There are multiple issues upstream - it think this is closest to the one I want.

In the meantime I added

.page {
  filter: invert(100%);
}

to pdfjs/web/viewer.less which is fine for me. :)

allefeld commented 4 years ago

I didn't realize it would be that simple!

I'll think about whether it makes sense to make that a package option.

YtvwlD commented 4 years ago

That would be great. Oh, and the CSS has to be added to the thumbnails as well, so it's

.page, .thumbnailImage {
  filter: invert(100%);
}
allefeld commented 2 years ago

I added an option "Invert PDF colors" which appends your CSS to the stylesheet.

allefeld commented 2 years ago

published with v1.3.0