use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Get Firefox
Official Mozilla Discourse
r/Firefox wiki - (basic troubleshooting)
Ask for help on Support Mozilla
Report a bug
the front page of the internet.
and join one of thousands of communities.
Dark PDF Preview?Question (self.firefox)
submitted 6 years ago by EternalNY1
Is there any way to have Firefox preview PDFs in dark mode (inverted)?
I have "Dark Background and Light Text" installed but this doesn't handle the PDF previewer. Stylus can't "communicate with the page" on the previews so no help there.
Post a comment!
[–]jscher2000Firefox Windows 2 points3 points4 points 6 years ago (5 children)
What you see in the PDF viewer, each individual page, is an HTML <canvas>. There is a transparent text layer in front of the canvas for searching and selecting; that doesn't need any changes. You can invert the canvas using a CSS filter. For example:
#viewerContainer > #viewer > .page > .canvasWrapper > canvas { filter: invert(100%); }
The selection highlight is hard to see on black, so you could modify the color:
#viewerContainer > #viewer > .page > .textLayer ::selection { background-color: yellow; }
You can apply these rules using a userContent.css file which goes into the same folder as a userChrome.css file (content being for the web content area and chrome being for the UI).
Unfortunately, colorful brochures probably will look ridiculous. It's difficult to do anything custom with this one.
[–][deleted] 0 points1 point2 points 6 years ago (1 child)
Hey. Thanks for the help about this. Would there be any way to change the background color to black and the text to white, while keeping all other colors intact? Thanks in advance.
[–]jscher2000Firefox Windows 0 points1 point2 points 6 years ago (0 children)
Possibly. I'm not very knowledgeable about canvas styling. Because there is a transparent text layer, if you were able to black out the background -- so it was black on black -- you could color the text layer white for reading.
[–][deleted] 0 points1 point2 points 6 years ago* (2 children)
Oh also, what's the full path to save this to? I haven't been able to locate where the userChrome.css would go.
Edit: Nevermind, I found the location. However, how do I make my browser load my .css file every time I open a .pdf? Thanks.
[–]jscher2000Firefox Windows 0 points1 point2 points 6 years ago (1 child)
how do I make my browser load my .css file every time I open a .pdf?
Firefox should apply userContent.css to every page. The selectors in the above rules should always match the PDF Viewer. Are there particular URLs where it doesn't work?
If it doesn't work anywhere:
If you are setting up a userChrome.css or userContent.css for the first time in Firefox 69 or later, you also need to set Firefox to look for the file at startup:
[–][deleted] 0 points1 point2 points 6 years ago (0 children)
Ah thank you, your first page was very helpful (I'd already seen the 2nd). I just needed to change the name from userChrome.css to userContent.css. Thank you so much for the help, I really appreciate it.
π Rendered by PID 256095 on reddit-service-r2-loggedout-7cbc86668b-njbwc at 2026-07-02 21:13:26.914972+00:00 running 12a7a47 country code: JP.
Want to add to the discussion?
Post a comment!