diff --git a/chrome/content/zotero/standalone/standalone.js b/chrome/content/zotero/standalone/standalone.js index cb9e4e7e5e..e6bc926427 100644 --- a/chrome/content/zotero/standalone/standalone.js +++ b/chrome/content/zotero/standalone/standalone.js @@ -557,6 +557,8 @@ const ZoteroStandalone = new function() { } this.updateMenuItemCheckmark('view-menuitem-split-vertically', reader.splitType === 'vertical'); this.updateMenuItemCheckmark('view-menuitem-split-horizontally', reader.splitType === 'horizontal'); + this.updateMenuItemCheckmark('view-menuitem-use-dark-mode-for-content', Zotero.Prefs.get('reader.useDarkModeForContent')); + this.updateMenuItemEnabled('view-menuitem-use-dark-mode-for-content', window.matchMedia('(prefers-color-scheme: dark)').matches); } // Layout mode diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index 7899fac8c6..ba93218a7f 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -215,6 +215,7 @@ class ReaderInstance { ...Zotero.Intl.getPrefixedStrings('pdfReader.') }, showAnnotations: true, + useDarkModeForContent: Zotero.Prefs.get('reader.useDarkModeForContent'), fontFamily: Zotero.Prefs.get('reader.ebookFontFamily'), onOpenContextMenu: () => { // Functions can only be passed over wrappedJSObject (we call back onClick for context menu items) @@ -507,6 +508,7 @@ class ReaderInstance { this._prefObserverIDs = [ Zotero.Prefs.registerObserver('fontSize', this._handleFontSizeChange), Zotero.Prefs.registerObserver('tabs.title.reader', this._handleTabTitlePrefChange), + Zotero.Prefs.registerObserver('reader.useDarkModeForContent', this._handleContentDarkModeChange), Zotero.Prefs.registerObserver('reader.ebookFontFamily', this._handleFontFamilyChange), ]; @@ -832,6 +834,10 @@ class ReaderInstance { await this.updateTitle(); }; + _handleContentDarkModeChange = () => { + this._internalReader.useDarkModeForContent(Zotero.Prefs.get('reader.useDarkModeForContent')); + }; + _handleFontFamilyChange = () => { this._internalReader.setFontFamily(Zotero.Prefs.get('reader.ebookFontFamily')); }; diff --git a/chrome/content/zotero/zoteroPane.xhtml b/chrome/content/zotero/zoteroPane.xhtml index c5dda80876..3a55d95407 100644 --- a/chrome/content/zotero/zoteroPane.xhtml +++ b/chrome/content/zotero/zoteroPane.xhtml @@ -515,7 +515,14 @@ oncommand="ZoteroStandalone.currentReader.toggleVerticalSplit()" /> - + + + diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js index 9a4e4c1a08..b721d1cb8f 100644 --- a/defaults/preferences/zotero.js +++ b/defaults/preferences/zotero.js @@ -219,6 +219,7 @@ pref("extensions.zotero.scaffold.eslint.enabled", true); pref("extensions.zotero.tabs.title.reader", "titleCreatorYear"); // Reader +pref("extensions.zotero.reader.useDarkModeForContent", true); pref("extensions.zotero.reader.ebookFontFamily", "Georgia, serif"); // Set color scheme to auto by default diff --git a/reader b/reader index 4b0c629ee1..6a281b3975 160000 --- a/reader +++ b/reader @@ -1 +1 @@ -Subproject commit 4b0c629ee10df3978abd84b665954b16fb176aeb +Subproject commit 6a281b397531825a5bd973f0e8260eeb1c62b44d