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():
|
def system_colors():
|
||||||
pal = QApplication.instance().palette()
|
app = QApplication.instance()
|
||||||
return {
|
is_dark_theme = app.is_dark_theme
|
||||||
|
pal = app.palette()
|
||||||
|
ans = {
|
||||||
'background': pal.color(pal.Base).name(),
|
'background': pal.color(pal.Base).name(),
|
||||||
'foreground': pal.color(pal.Text).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):
|
class WebView(RestartingWebEngineView):
|
||||||
|
@ -60,7 +60,9 @@ def set_system_colors(spec):
|
|||||||
c = default_color_schemes.system
|
c = default_color_schemes.system
|
||||||
c.foreground = spec.foreground
|
c.foreground = spec.foreground
|
||||||
c.background = spec.background
|
c.background = spec.background
|
||||||
c.link = spec.link
|
v'delete c.link'
|
||||||
|
if spec.link:
|
||||||
|
c.link = spec.link
|
||||||
|
|
||||||
register_callback(def():
|
register_callback(def():
|
||||||
# Ensure the color scheme names are translated
|
# Ensure the color scheme names are translated
|
||||||
|
Loading…
x
Reference in New Issue
Block a user