mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Preview panel: In dark mode when all of the background/foreground/link colors are set to "No change" do not render the book using dark colors
This commit is contained in:
parent
66c7741822
commit
37fd854e33
@ -407,7 +407,9 @@ class PreviewSettings(BasicSettings): # {{{
|
|||||||
ans.setObjectName(name)
|
ans.setObjectName(name)
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
b('unset', _('No change'), _('Use the colors from the book styles, defaulting to black-on-white'))
|
b('unset', _('No change'), _('Use the colors from the book styles, defaulting to black-on-white.'
|
||||||
|
' Note that in dark mode, you must set all three colors to "No change"'
|
||||||
|
' otherwise the book is rendered with dark colors.'))
|
||||||
b('auto', _('Theme based'), _('When using a dark theme force dark colors, otherwise same as "No change"'))
|
b('auto', _('Theme based'), _('When using a dark theme force dark colors, otherwise same as "No change"'))
|
||||||
b('manual', _('Custom'), _('Choose a custom color'))
|
b('manual', _('Custom'), _('Choose a custom color'))
|
||||||
|
|
||||||
|
@ -277,7 +277,9 @@ def create_dark_mode_script():
|
|||||||
function apply_css() {
|
function apply_css() {
|
||||||
var css = '';
|
var css = '';
|
||||||
if (settings.link) css += 'html > body :link, html > body :link * { color: ' + settings.link + ' !important; }';
|
if (settings.link) css += 'html > body :link, html > body :link * { color: ' + settings.link + ' !important; }';
|
||||||
if (settings.is_dark_theme) { css = ':root { color-scheme: dark; }' + css; }
|
var using_custom_colors = false;
|
||||||
|
if (settings.bg || settings.fg || settings.link) using_custom_colors = true;
|
||||||
|
if (settings.is_dark_theme && using_custom_colors) { css = ':root { color-scheme: dark; }' + css; }
|
||||||
var style = document.createElement('style');
|
var style = document.createElement('style');
|
||||||
style.textContent = css;
|
style.textContent = css;
|
||||||
document.documentElement.appendChild(style);
|
document.documentElement.appendChild(style);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user