diff --git a/qt/aqt/preferences.py b/qt/aqt/preferences.py index 5b997724f..ecfbe64cf 100644 --- a/qt/aqt/preferences.py +++ b/qt/aqt/preferences.py @@ -10,6 +10,7 @@ import aqt from anki.lang import _ from aqt import AnkiQt from aqt.qt import * +from aqt.theme import theme_manager from aqt.utils import TR, askUser, openHelp, showInfo, showWarning, tr @@ -234,6 +235,11 @@ Not currently enabled; click the sync button in the main window to enable.""" self.form.pasteInvert.setChecked(self.prof.get("pasteInvert", False)) self.form.showPlayButtons.setChecked(self.prof.get("showPlayButtons", True)) self.form.nightMode.setChecked(self.mw.pm.night_mode()) + if theme_manager.macos_dark_mode(): + self.form.nightMode.setChecked(True) + self.form.nightMode.setText(tr(TR.PREFERENCES_DARK_MODE_ACTIVE)) + else: + self.form.nightMode.setChecked(self.mw.pm.night_mode()) self.form.interrupt_audio.setChecked(self.mw.pm.interrupt_audio()) def updateOptions(self): @@ -247,9 +253,17 @@ Not currently enabled; click the sync button in the main window to enable.""" restart_required = True self.prof["showPlayButtons"] = self.form.showPlayButtons.isChecked() - if self.mw.pm.night_mode() != self.form.nightMode.isChecked(): - self.mw.pm.set_night_mode(not self.mw.pm.night_mode()) - restart_required = True + if theme_manager.macos_dark_mode(): + if not self.form.nightMode.isChecked(): + # user is trying to turn it off, but it's forced + showInfo( + tr(TR.PREFERENCES_DARK_MODE_DISABLE), textFormat="rich", + ) + openHelp("profileprefs") + else: + if self.mw.pm.night_mode() != self.form.nightMode.isChecked(): + self.mw.pm.set_night_mode(not self.mw.pm.night_mode()) + restart_required = True self.mw.pm.set_interrupt_audio(self.form.interrupt_audio.isChecked()) diff --git a/qt/ftl/preferences.ftl b/qt/ftl/preferences.ftl new file mode 100644 index 000000000..7e4249e16 --- /dev/null +++ b/qt/ftl/preferences.ftl @@ -0,0 +1,7 @@ +# shown instead of the 'night mode' option when night mode is forced on because +# macOS is in dark mode +preferences-dark-mode-active = macOS is in dark mode + +preferences-dark-mode-disable = + To show Anki in light mode while macOS is in dark mode, please + see the Night Mode section of the manual.