mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
DRYer
This commit is contained in:
parent
a0041b8dce
commit
72bfb00300
@ -58,16 +58,17 @@ styles_id = 'calibre-color-scheme-style-overrides'
|
|||||||
|
|
||||||
|
|
||||||
def apply_colors(is_content_popup):
|
def apply_colors(is_content_popup):
|
||||||
document.documentElement.setProperty('--calibre-viewer-background-color', opts.color_scheme.background)
|
des = document.documentElement.style
|
||||||
document.documentElement.setProperty('--calibre-viewer-foreground-color', opts.color_scheme.foreground)
|
des.setProperty('--calibre-viewer-background-color', opts.color_scheme.background)
|
||||||
|
des.setProperty('--calibre-viewer-foreground-color', opts.color_scheme.foreground)
|
||||||
if opts.color_scheme.link:
|
if opts.color_scheme.link:
|
||||||
document.documentElement.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):
|
||||||
elem.style.color = opts.color_scheme.foreground
|
elem.style.color = opts.color_scheme.foreground
|
||||||
# set background color to transparent so that the users background
|
# set background color to transparent so that the users background
|
||||||
# color which is set on the iframe is used instead
|
# color which is set on the iframe is used instead
|
||||||
elem.style.backgroundColor = 'transparent'
|
elem.style.backgroundColor = 'transparent'
|
||||||
document.documentElement.style.backgroundColor = opts.bg_image_fade
|
des.backgroundColor = opts.bg_image_fade
|
||||||
ss = document.getElementById('calibre-color-scheme-style-overrides')
|
ss = document.getElementById('calibre-color-scheme-style-overrides')
|
||||||
if not ss:
|
if not ss:
|
||||||
ss = E.style(id=styles_id, type='text/css')
|
ss = E.style(id=styles_id, type='text/css')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user