Set background color on ifrae rather than iframe contents

This commit is contained in:
Kovid Goyal 2019-09-24 17:02:57 +05:30
parent 0ed3a5e636
commit d35e5c78ed
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 1 deletions

View File

@ -29,7 +29,9 @@ def apply_font_size():
def apply_colors():
for elem in (document.documentElement, document.body):
elem.style.color = opts.color_scheme.foreground
elem.style.backgroundColor = opts.color_scheme.background
# set background color to transparent so that the users background
# color which is set on the iframe is used instead
elem.style.backgroundColor = 'transparent'
ss = document.getElementById('calibre-color-scheme-style-overrides')
if not ss:
ss = E.style(id='calibre-color-scheme-style-overrides', type='text/css')

View File

@ -435,6 +435,7 @@ class View:
s = m.style
s.color = ans.foreground
s.backgroundColor = ans.background
self.iframe.style.backgroundColor = ans.background or 'white'
m.parentNode.style.backgroundColor = ans.background # this is needed on iOS where the bottom margin has its own margin, so we dont want the body background color to bleed through
self.content_popup_overlay.apply_color_scheme(ans.background, ans.foreground)
return ans