diff --git a/src/calibre/gui2/tweak_book/preferences.py b/src/calibre/gui2/tweak_book/preferences.py index dc4c022117..cac49bc710 100644 --- a/src/calibre/gui2/tweak_book/preferences.py +++ b/src/calibre/gui2/tweak_book/preferences.py @@ -407,7 +407,9 @@ class PreviewSettings(BasicSettings): # {{{ ans.setObjectName(name) return ans - b('unset', _('No change'), _('Use the colors from the book styles, defaulting to black-on-white')) + b('unset', _('No change'), _('Use the colors from the book styles, defaulting to black-on-white.' + ' Note that in dark mode, you must set all three colors to "No change"' + ' otherwise the book is rendered with dark colors.')) b('auto', _('Theme based'), _('When using a dark theme force dark colors, otherwise same as "No change"')) b('manual', _('Custom'), _('Choose a custom color')) diff --git a/src/calibre/gui2/tweak_book/preview.py b/src/calibre/gui2/tweak_book/preview.py index fa7d1b1015..8cd226ef5a 100644 --- a/src/calibre/gui2/tweak_book/preview.py +++ b/src/calibre/gui2/tweak_book/preview.py @@ -277,7 +277,9 @@ def create_dark_mode_script(): function apply_css() { var css = ''; if (settings.link) css += 'html > body :link, html > body :link * { color: ' + settings.link + ' !important; }'; - if (settings.is_dark_theme) { css = ':root { color-scheme: dark; }' + css; } + var using_custom_colors = false; + if (settings.bg || settings.fg || settings.link) using_custom_colors = true; + if (settings.is_dark_theme && using_custom_colors) { css = ':root { color-scheme: dark; }' + css; } var style = document.createElement('style'); style.textContent = css; document.documentElement.appendChild(style);