-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Add a new preference, viewerCssTheme
, to allow forcing the use of the light/dark viewer CSS themes (issue 12290)
#12625
Add a new preference, viewerCssTheme
, to allow forcing the use of the light/dark viewer CSS themes (issue 12290)
#12625
Conversation
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/946bd442c0cdd65/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/946bd442c0cdd65/output.txt Total script time: 4.16 mins Published |
I might be doing something wrong here, but when running
Edit: Huh, this happens only when I reload the page with the console opened. If I run that line of code in the console, close the console and then reload the page is does work :-s |
6dc332f
to
bbdc991
Compare
That's really weird, and unfortunately I can't reproduce it with Firefox Nightly 84.0a1 (2020-11-15) (64-bit); however I've submitted a patch which hopefully should prevent that particular error. Edit: Also, I've pushed an updated version of the patch which wraps all of the styleSheet fetching/parsing in |
954d38f
to
5c00c28
Compare
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/a2663e4aabe9cdf/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/a2663e4aabe9cdf/output.txt Total script time: 4.17 mins Published |
…he light/dark viewer CSS themes (issue 12290) While this does work pretty well in my quick testing, it's *very much* a hack since as far as I can tell there's no support in the CSS specification for using e.g. a CSS variable to override a `@media (prefers-color-scheme: dark) {...}` block. The solution implemented here is thus to *edit* the viewer CSS, by either removing the entire `@media ...` block in light-mode or by ensuring that its rules become *unconditionally* applied in dark-mode. To simplify the overall implementation, since all of this does seem like somewhat of an edge-case, the `viewerCssTheme` preference will *only* be read during viewer initialization. (Similar to many other existing preferences, a reload is thus required when changing it.)
5c00c28
to
40a4d53
Compare
The reason for the error is at least more clear now: |
That one also references https://bugzilla.mozilla.org/show_bug.cgi?id=1673199, a regression in Firefox 82, which was fixed in Firefox 84 (and uplifted to Firefox 83); so there's a chance that it's actually fixed :-) Thanks for landing this; hopefully it'll help users work-around some of the problems described in #12290. |
Given issues/bugs such as #12290 and bug 1660650, which show that a fair number of users clearly want to enforce the dark-theme for the PDF Viewer, I'm wondering if this is the sort of patch that we should consider uplifting to previous Firefox versions (once it's landed in Nightly of course)? /cc @brendandahl As far as I'm concerned, it should be fairly safe to uplift this since all code which could potentially throw is wrapped in |
Why isn't this preference exported to Options? |
Huh; please actually provide enough context with your question to make it easily understandable, since I've got no idea what "Options" you're referring to here! Note that this is, in the |
I was referring to the 'Extension options' (I have built the extension from master and can set the cssTheme from preferences with the desired effect, but don't see anything in Extension options'.) This is in Chrome. That was easy to fix:
|
While this does work pretty well in my quick testing, it's very much a hack since as far as I can tell there's no support in the CSS specification for using e.g. a CSS variable to override a
@media (prefers-color-scheme: dark) {...}
block.The solution implemented here is thus to edit the viewer CSS, by either removing the entire
@media ...
block in light-mode or by ensuring that its rules become unconditionally applied in dark-mode.To simplify the overall implementation, since all of this does seem like somewhat of an edge-case, the
viewerCssTheme
preference will only be read during viewer initialization. (Similar to many other existing preferences, a reload is thus required when changing it.)