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()"
/>