Ensure selection color does not change when iframe is de-focused

This commit is contained in:
Kovid Goyal 2020-03-20 20:25:39 +05:30
parent 5bab8e8292
commit 51d7ac1baa
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -3,7 +3,8 @@
from __python__ import hash_literals
from elementmaker import E
from read_book.globals import runtime
from read_book.globals import dark_link_color, runtime
from session import defaults
opts = {}
@ -63,6 +64,15 @@ def apply_colors():
# priority than the override all selectors above
text += f'\nhtml > body :link, html > body :link * {{ color: {c} !important }} html > body :visited, html > body :visited * {{ color: {c} !important }}'
if opts.is_dark_theme:
selbg = dark_link_color
selfg = 'black'
else:
selbg = '#3297FD'
selfg = 'white'
text += f'\n::selection {{ background-color: {selbg}; color: {selfg} }}'
text += f'\n::selection:window-inactive {{ background-color: {selbg}; color: {selfg} }}'
ss.textContent = text