This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

ابحث في الدعم

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How can I view pdfs in night/dark mode within the Firefox Quantum browser?

more options

As of Quantum, it seems that Firefox will not allow any extensions/add-ons to modify their pdf viewer page, and Firefox will also not allow any other third party pdf viewers to be used (within the browser). That would be ok, I guess, if the Firefox viewer had a night mode built in or were otherwise a little more feature-rich. Is there something I haven't tried yet? And yes, I know I can choose to open a pdf in a third party application, but opening it within the browser would be much preferred.

As of Quantum, it seems that Firefox will not allow any extensions/add-ons to modify their pdf viewer page, and Firefox will also not allow any other third party pdf viewers to be used (within the browser). That would be ok, I guess, if the Firefox viewer had a night mode built in or were otherwise a little more feature-rich. Is there something I haven't tried yet? And yes, I know I can choose to open a pdf in a third party application, but opening it within the browser would be much preferred.

All Replies (2)

more options

Hi beersteiner, the viewer itself has a dark theme. Do you mean you want the appearance of the PDF file itself inverted to light text on a dark background? Hmm...

Although extensions cannot modify tabs using the PDF Viewer, the userContent.css file can inject alternative style rules. For example, playing around in the Style Editor tool, I was able to apply an "invert" filter by clicking the + to create a new style sheet and then using:

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

Example "before" and "after" screenshots attached.

When saved in a userContent.css file there is a risk that could affect other pages. To minimize that risk, you could use a selector that follows the presumably unique structure of the viewer:

#outerContainer > #mainContainer > #viewerContainer > #viewer > .page {
  filter: invert(100%);
}

I haven't gone all the way to setting that up in userContent.css to test it. Maybe later when I have some more time.

more options

Hmm, the invert rule would flip a dark PDF to light, so it's not an ideal solution.