From ffeb7f5e3ce15c44e9ab3b8151bdbb3c336d0699 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 17 Jul 2022 21:02:29 +0530 Subject: [PATCH] Content server: Fix a regression in 6.0 that caused incorrect rendering of comments metadata in the book details panel in dark mode. Fixes #1981886 [[Content Server] Back ground of Comments section is white on dark mode](https://bugs.launchpad.net/calibre/+bug/1981886) --- src/pyj/book_list/book_details.pyj | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index d7a49f0cd1..b05bc59d4c 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -15,7 +15,9 @@ from book_list.library_data import ( set_book_metadata ) from book_list.router import back, home, open_book, report_a_load_failure -from book_list.theme import get_color, get_color_as_rgba, get_font_size +from book_list.theme import ( + browser_in_dark_mode, get_color, get_color_as_rgba, get_font_size +) from book_list.top_bar import add_button, clear_buttons, create_top_bar, set_title from book_list.ui import query_as_href, set_panel_handler, show_panel from book_list.views import search_query_for @@ -148,7 +150,8 @@ if window?: def adjusting_sandboxed_html(html, extra_css): color = get_color_as_rgba('window-foreground') - css = f'html, body {{ overflow: hidden; color: rgba({color[0]}, {color[1]}, {color[2]}, {color[3]}) }}' + cs = 'dark' if browser_in_dark_mode() else 'light' + css = f'\n\n:root {{ color-scheme: {cs} }}\n\nhtml, body {{ overflow: hidden; color: rgba({color[0]}, {color[1]}, {color[2]}, {color[3]}) }}' if extra_css: css += '\n\n' + extra_css # allow-same-origin is needed for resizing and allow-popups is needed for