diff --git a/src/calibre/gui2/viewer/web_view.py b/src/calibre/gui2/viewer/web_view.py index 22b36d438c..17fb801177 100644 --- a/src/calibre/gui2/viewer/web_view.py +++ b/src/calibre/gui2/viewer/web_view.py @@ -387,12 +387,19 @@ class Inspector(QWidget): def system_colors(): - pal = QApplication.instance().palette() - return { + app = QApplication.instance() + is_dark_theme = app.is_dark_theme + pal = app.palette() + ans = { 'background': pal.color(pal.Base).name(), 'foreground': pal.color(pal.Text).name(), - 'link': pal.color(pal.Link).name(), } + if is_dark_theme: + # only override link colors for dark themes + # since if the book specifies its own link colors + # they will likely work well with light themes + ans['link'] = pal.color(pal.Link).name() + return ans class WebView(RestartingWebEngineView): diff --git a/src/pyj/read_book/globals.pyj b/src/pyj/read_book/globals.pyj index b906c67f31..8244679b77 100644 --- a/src/pyj/read_book/globals.pyj +++ b/src/pyj/read_book/globals.pyj @@ -60,7 +60,9 @@ def set_system_colors(spec): c = default_color_schemes.system c.foreground = spec.foreground c.background = spec.background - c.link = spec.link + v'delete c.link' + if spec.link: + c.link = spec.link register_callback(def(): # Ensure the color scheme names are translated