mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-29 23:06:02 +01:00
Viewer: Fix the color of browser provided controls in dark mode
This commit is contained in:
parent
265bd1358d
commit
b160c3d0a4
2 changed files with 3 additions and 1 deletions
|
|
@ -74,6 +74,7 @@ def set_ui_colors(is_dark_theme):
|
|||
s.setProperty('--calibre-color-' + k, val)
|
||||
get_color_as_rgba.cache = {}
|
||||
cached_color_to_rgba.cache = {}
|
||||
document.documentElement.style.colorScheme = 'dark' if is_dark_theme else 'light'
|
||||
|
||||
|
||||
def browser_in_dark_mode():
|
||||
|
|
@ -96,7 +97,7 @@ def css_for_variables():
|
|||
for k in DEFAULT_COLORS:
|
||||
val = DEFAULT_COLORS[k][attr]
|
||||
ans.push(f'--calibre-color-{k}: {val};')
|
||||
return ':root { ' + ans.join('\n') + '}\n\n' + input_css
|
||||
return f':root {{ color-scheme: {attr}; ' + ans.join('\n') + '}\n\n' + input_css
|
||||
|
||||
|
||||
def get_color(name):
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ def apply_colors(is_content_popup):
|
|||
des = document.documentElement.style
|
||||
des.setProperty('--calibre-viewer-background-color', opts.color_scheme.background)
|
||||
des.setProperty('--calibre-viewer-foreground-color', opts.color_scheme.foreground)
|
||||
des.colorScheme = 'dark' if opts.is_dark_theme else 'light'
|
||||
if opts.color_scheme.link:
|
||||
des.setProperty('--calibre-viewer-link-color', opts.color_scheme.link)
|
||||
for elem in (document.documentElement, document.body):
|
||||
|
|
|
|||
Loading…
Reference in a new issue