Closed MagicalDrizzle closed 6 months ago
Thanks for pointing this out! I did know of that pref, but I did not know about privacy.resistFingerprinting
and its effect on prefers-color-scheme
.
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 https://github.com/mozilla/pdf.js/pull/12625#issue-743267748. π
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!
provide an Options page to set the pref, as well as the other prefs.
oh that was what I meant by "manual toggle" oops
also not having a toggle and having the dark theme only accessible by prefers-color-scheme
is my biggest gripe of quite a few extensions that are like, out for my eyes (onetab being the biggest offender :p)
that was not directed at you by any means btw
Great!
oh that was what I meant by "manual toggle" oops
In the linked issue, somebody was asking for a manual toggle button on the toolbar itself, so I thought you meant that. π
~This should be ready by v0.3~.
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 https://github.com/shivaprsd/doqment/issues/5#issuecomment-1421103657? 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.
Windows 10 19045.2965, Firefox 114.0.1, doqment v0.4
@shivaprsd It seems it only works when you open the extension page itself (so address bar shows the "ugly" moz-extension url)
If you paste it in a tab with something other than that (like when you paste the DOI in scihub) then it won't work (probably for obvious reasons)
On that particular page (and many others), the pdf is shown inside an
Edit: that button is only shown when there is at least one iframe present
On that particular page (and many others), the pdf is shown inside an
@KiitoX I had suspected this. But I didn't know the button shows up only in pages with iframes. Thanks for clearing it up!
It seems it only works when you open the extension page itself
@MagicalDrizzle Yes, correct. Just execute it with the value 2
in the extension page and reload it. It will then start to apply everywhere automatically, including iframes, so you don't have to do it again for the other page.
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! I will say this extension has basically saved my eyesights as I look at sci-hub all the time at 2am... I'm glad to be able to see it develop ^^
@MagicalDrizzle Version 0.7 in now live in the Add-ons store.
Happy New Year! π
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: https://github.com/mozilla/pdf.js/issues/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?