mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Viewer: When using the system color theme only override link colors in the book if the theme is dark. Fixes #1852990 [Viewer ignores color-property for links](https://bugs.launchpad.net/calibre/+bug/1852990)
This commit is contained in:
parent
ee5dd52ec1
commit
286efc792e
@ -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):
|
||||
|
@ -60,6 +60,8 @@ def set_system_colors(spec):
|
||||
c = default_color_schemes.system
|
||||
c.foreground = spec.foreground
|
||||
c.background = spec.background
|
||||
v'delete c.link'
|
||||
if spec.link:
|
||||
c.link = spec.link
|
||||
|
||||
register_callback(def():
|
||||
|
Loading…
x
Reference in New Issue
Block a user