From 7a0ccb4476eee72dd4d5975477220c653c67d6f7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Aug 2022 19:22:44 +0530 Subject: [PATCH] Content server: Fix margin and body background color mismatch when reading books with a non-white/black color scheme. Fixes #1985058 [[Content Server] Margin colors not matching body background colors](https://bugs.launchpad.net/calibre/+bug/1985058) --- src/pyj/read_book/view.pyj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index 3f7f8902fb..62312cf24d 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -798,8 +798,12 @@ class View: def apply_color_scheme(self): self.current_color_scheme = ans = resolve_color_scheme() + iframe = self.iframe if runtime.is_standalone_viewer: set_ui_colors(self.current_color_scheme.is_dark_theme) + else: + iframe.style.colorScheme = 'dark' if self.current_color_scheme.is_dark_theme else 'light' + is_dark_theme(self.current_color_scheme.is_dark_theme) for which in 'left top right bottom'.split(' '): m = document.getElementById('book-{}-margin'.format(which)) @@ -811,7 +815,6 @@ class View: s.color = ans.foreground s.backgroundColor = ans.background sd = get_session_data() - iframe = self.iframe iframe.style.backgroundColor = ans.background or 'white' bg_image = sd.get('background_image') if bg_image: