mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Viewer: Fix the color of browser provided controls in dark mode
This commit is contained in:
parent
3523abef08
commit
259c7398cb
@ -74,6 +74,7 @@ def set_ui_colors(is_dark_theme):
|
|||||||
s.setProperty('--calibre-color-' + k, val)
|
s.setProperty('--calibre-color-' + k, val)
|
||||||
get_color_as_rgba.cache = {}
|
get_color_as_rgba.cache = {}
|
||||||
cached_color_to_rgba.cache = {}
|
cached_color_to_rgba.cache = {}
|
||||||
|
document.documentElement.style.colorScheme = 'dark' if is_dark_theme else 'light'
|
||||||
|
|
||||||
|
|
||||||
def browser_in_dark_mode():
|
def browser_in_dark_mode():
|
||||||
@ -96,7 +97,7 @@ def css_for_variables():
|
|||||||
for k in DEFAULT_COLORS:
|
for k in DEFAULT_COLORS:
|
||||||
val = DEFAULT_COLORS[k][attr]
|
val = DEFAULT_COLORS[k][attr]
|
||||||
ans.push(f'--calibre-color-{k}: {val};')
|
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):
|
def get_color(name):
|
||||||
|
@ -61,6 +61,7 @@ def apply_colors(is_content_popup):
|
|||||||
des = document.documentElement.style
|
des = document.documentElement.style
|
||||||
des.setProperty('--calibre-viewer-background-color', opts.color_scheme.background)
|
des.setProperty('--calibre-viewer-background-color', opts.color_scheme.background)
|
||||||
des.setProperty('--calibre-viewer-foreground-color', opts.color_scheme.foreground)
|
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:
|
if opts.color_scheme.link:
|
||||||
des.setProperty('--calibre-viewer-link-color', opts.color_scheme.link)
|
des.setProperty('--calibre-viewer-link-color', opts.color_scheme.link)
|
||||||
for elem in (document.documentElement, document.body):
|
for elem in (document.documentElement, document.body):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user