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)

This commit is contained in:
Kovid Goyal 2022-07-17 21:02:29 +05:30
parent 563c1089df
commit ffeb7f5e3c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -15,7 +15,9 @@ from book_list.library_data import (
set_book_metadata set_book_metadata
) )
from book_list.router import back, home, open_book, report_a_load_failure 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.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.ui import query_as_href, set_panel_handler, show_panel
from book_list.views import search_query_for from book_list.views import search_query_for
@ -148,7 +150,8 @@ if window?:
def adjusting_sandboxed_html(html, extra_css): def adjusting_sandboxed_html(html, extra_css):
color = get_color_as_rgba('window-foreground') 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: if extra_css:
css += '\n\n' + extra_css css += '\n\n' + extra_css
# allow-same-origin is needed for resizing and allow-popups is needed for # allow-same-origin is needed for resizing and allow-popups is needed for