mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Restore the option to set light/dark mode for chromium and generic builds
This commit is contained in:
parent
ffbfd680ec
commit
53101b379b
6 changed files with 62 additions and 2 deletions
15
web/app.js
15
web/app.js
|
@ -228,6 +228,21 @@ const PDFViewerApplication = {
|
|||
await this._parseHashParams();
|
||||
}
|
||||
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
||||
let mode;
|
||||
switch (AppOptions.get("viewerCssTheme")) {
|
||||
case 1:
|
||||
mode = "is-light";
|
||||
break;
|
||||
case 2:
|
||||
mode = "is-dark";
|
||||
break;
|
||||
}
|
||||
if (mode) {
|
||||
document.documentElement.classList.add(mode);
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure that the `L10n`-instance has been initialized before creating
|
||||
// e.g. the various viewer components.
|
||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||
|
|
|
@ -329,6 +329,13 @@ const defaultOptions = {
|
|||
kind: OptionKind.WORKER,
|
||||
},
|
||||
};
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
||||
defaultOptions.viewerCssTheme = {
|
||||
/** @type {number} */
|
||||
value: typeof PDFJSDev !== "undefined" && PDFJSDev.test("CHROME") ? 2 : 0,
|
||||
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
|
||||
};
|
||||
}
|
||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
||||
defaultOptions.defaultUrl = {
|
||||
/** @type {string} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue