mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Content server: Fix light background for comments editor in dark mode
This commit is contained in:
parent
96d9f39ad0
commit
2346792bad
@ -3,10 +3,10 @@
|
||||
from __python__ import bound_methods, hash_literals
|
||||
|
||||
from elementmaker import E
|
||||
from gettext import gettext as _
|
||||
|
||||
from book_list.theme import get_color, get_color_as_rgba
|
||||
from book_list.theme import browser_in_dark_mode, get_color, get_color_as_rgba
|
||||
from dom import add_extra_css, build_rule, clear, svgicon
|
||||
from gettext import gettext as _
|
||||
from iframe_comm import IframeClient, create_wrapped_iframe
|
||||
from modals import create_custom_dialog
|
||||
from utils import html_escape
|
||||
@ -319,6 +319,8 @@ class CommentsEditorBoss:
|
||||
console.log(error_object)
|
||||
|
||||
def set_html(self, data):
|
||||
if data.color_scheme:
|
||||
document.documentElement.style.colorScheme = data.color_scheme
|
||||
document.body.style.color = data.color
|
||||
document.body.lastChild.innerHTML = data.html
|
||||
|
||||
@ -394,7 +396,8 @@ class Editor:
|
||||
self.pending_set_html = html
|
||||
return
|
||||
rgba = get_color_as_rgba('window-foreground')
|
||||
self.iframe_wrapper.send_message('set_html', html=html, color=f'rgba({rgba[0]},{rgba[1]},{rgba[2]},{rgba[3]})')
|
||||
cs = 'dark' if browser_in_dark_mode() else 'light'
|
||||
self.iframe_wrapper.send_message('set_html', html=html, color_scheme=cs, color=f'rgba({rgba[0]},{rgba[1]},{rgba[2]},{rgba[3]})')
|
||||
|
||||
def get_html(self, proceed):
|
||||
self.get_html_callbacks.push(proceed)
|
||||
|
Loading…
x
Reference in New Issue
Block a user