From d35e5c78edba9745e542559ffb51ed2070dead09 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 24 Sep 2019 17:02:57 +0530 Subject: [PATCH] Set background color on ifrae rather than iframe contents --- src/pyj/read_book/settings.pyj | 4 +++- src/pyj/read_book/view.pyj | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pyj/read_book/settings.pyj b/src/pyj/read_book/settings.pyj index f1ff9c85e6..2057256846 100644 --- a/src/pyj/read_book/settings.pyj +++ b/src/pyj/read_book/settings.pyj @@ -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') diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index 8b749b23e3..b5bff4b98b 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -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