-
Notifications
You must be signed in to change notification settings - Fork 1
Need to set PDF.js preferences #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for pointing this out! I did know of that pref, but I did not know about I would be hard-pressed to implement a manual toggle; even the original maintainers could not find a way to modify the needed CSS dynamically – see mozilla/pdf.js#12625 (comment). 🙃 A wider-scoped workaround would be to provide an Options page to set the pref, as well as the other prefs. This has been wanting since v0.1 and I've been planning to add one on the lines of the PDF.js Chrome extension. Will the Options page cover your use-case well enough? It would be quickly accessible, by right-clicking on the doqment button on the toolbar. |
it'd definitely be good enough!
oh that was what I meant by "manual toggle" oops also not having a toggle and having the dark theme only accessible by |
Great!
In the linked issue, somebody was asking for a manual toggle button on the toolbar itself, so I thought you meant that. 😅
|
I am deferring this to a future release. The Options page would need some work, and I have other finished features to ship. Meanwhile, you can always have a dark Reader theme even when the PDF.js toolbars and stuff are light. doqment's prefs are separate from PDF.js's, and they are directly set from the toolbar. |
May I ask if you still have plan to work on this? |
@MagicalDrizzle Sorry about that! I'm sort of too busy to work on it at the moment. 😥 Meanwhile can you try the method given in #5 (comment)? You'll have to execute something like: PDFViewerApplication.preferences.set('viewerCssTheme', 2) /* for dark */ It's not as convenient as an options page, still, better than nothing for the time being. |
@shivaprsd It just returns a not defined error for me... |
@MagicalDrizzle Can you tell me what OS & browser you use and their versions? And also the version of doqment? The code should be executed in the console opened for a doqment tab, with or without any PDF loaded. But I guess you are doing just that, looking at the screenshot. I am curious why it shouldn't work. |
This comment was marked as outdated.
This comment was marked as outdated.
@shivaprsd It seems it only works when you open the extension page itself (so address bar shows the "ugly" moz-extension url) |
On that particular page (and many others), the pdf is shown inside an <iframe> Edit: that button is only shown when there is at least one iframe present |
@KiitoX I had suspected this. But I didn't know the button shows up only in pages with iframes. Thanks for clearing it up!
@MagicalDrizzle Yes, correct. Just execute it with the value You can use the same command to revert it as well. The values are 0 = automatic (default), 1 = always light, 2 = always dark. |
The Options page is in the works, and should be ready by the next release. The progress can be tracked here. Currently it looks like this, embedded in Extension Settings in Firefox (feedback welcome): The values are viewer defaults, but any overrides set via the console are respected; so migration won’t be a problem. |
do your best! |
@MagicalDrizzle Version 0.7 in now live in the Add-ons store. Happy New Year! 🎉 |
Uh oh!
There was an error while loading. Please reload this page.
It seems that since pdf.js only honors
prefers-color-scheme
, settingprivacy.resistFingerprinting = true
will force it to be white, and people have been asking for a manual dark mode toggle for quite a while: mozilla/pdf.js#12290The official pdf.js team however seems to have made a pref specifically for this, but that doesn't apply to doqment for obvious reasons
Could a manual toggle be implemented?
The text was updated successfully, but these errors were encountered: