mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Content server: Fix incorrect text color in detailed book list in dark mode
This commit is contained in:
parent
0906c226ea
commit
36198d500c
@ -5,7 +5,7 @@ from __python__ import bound_methods, hash_literals
|
||||
from elementmaker import E
|
||||
from gettext import gettext as _
|
||||
|
||||
from book_list.theme import get_color
|
||||
from book_list.theme import css_for_variables, get_color
|
||||
from dom import build_rule, clear, set_css, svgicon
|
||||
from session import get_interface_data
|
||||
from utils import fmt_sidx, safe_set_inner_html, sandboxed_html
|
||||
@ -66,8 +66,11 @@ def on_img_load(img, load_type):
|
||||
|
||||
|
||||
def sandbox_css():
|
||||
if not sandbox_css.ans:
|
||||
sandbox_css.ans = 'html {{ overflow: hidden; color: {} }}'.format(get_color('window-foreground'))
|
||||
is_dark_theme = window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
if not sandbox_css.ans or sandbox_css.is_dark_theme is not is_dark_theme:
|
||||
sandbox_css.ans = css_for_variables() + '\n\n'
|
||||
sandbox_css.ans += 'html {{ overflow: hidden; color: {} }}'.format(get_color('window-foreground'))
|
||||
sandbox_css.is_dark_theme = is_dark_theme
|
||||
return sandbox_css.ans
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user