mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Define the dark theme link color in only one place
This commit is contained in:
parent
0fdc70eac9
commit
ad56467166
@ -55,6 +55,7 @@ win32event = importlib.import_module('win32event') if iswindows else None
|
||||
winerror = importlib.import_module('winerror') if iswindows else None
|
||||
win32api = importlib.import_module('win32api') if iswindows else None
|
||||
fcntl = None if iswindows else importlib.import_module('fcntl')
|
||||
dark_link_color = '#2a82da'
|
||||
|
||||
_osx_ver = None
|
||||
|
||||
|
@ -5,9 +5,10 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
from PyQt5.Qt import QColor, QPalette, Qt
|
||||
from calibre.constants import dark_link_color
|
||||
|
||||
|
||||
dark_link_color = QColor(42, 130, 218)
|
||||
dark_link_color = QColor(dark_link_color)
|
||||
|
||||
|
||||
def dark_palette():
|
||||
|
@ -12,7 +12,9 @@ import sys
|
||||
from io import BytesIO
|
||||
|
||||
from calibre import force_unicode
|
||||
from calibre.constants import FAKE_HOST, FAKE_PROTOCOL, __appname__, __version__
|
||||
from calibre.constants import (
|
||||
FAKE_HOST, FAKE_PROTOCOL, __appname__, __version__, dark_link_color
|
||||
)
|
||||
from calibre.ptempfile import TemporaryDirectory
|
||||
from calibre.utils.filenames import atomic_rename
|
||||
from polyglot.builtins import (
|
||||
@ -354,7 +356,8 @@ def compile_viewer():
|
||||
js = compile_fast(f.read(), fname).replace(
|
||||
'__SPECIAL_TITLE__', special_title, 1).replace(
|
||||
'__FAKE_PROTOCOL__', FAKE_PROTOCOL, 1).replace(
|
||||
'__FAKE_HOST__', FAKE_HOST, 1)
|
||||
'__FAKE_HOST__', FAKE_HOST, 1).replace(
|
||||
'__DARK_LINK_COLOR__', dark_link_color, 1)
|
||||
base = os.path.join(base, 'resources')
|
||||
atomic_write(base, 'viewer.js', js)
|
||||
atomic_write(base, 'viewer.html', html)
|
||||
@ -379,7 +382,8 @@ def compile_srv():
|
||||
js = compile_fast(f.read(), fname, js_version=5).replace(
|
||||
'__RENDER_VERSION__', rv, 1).replace(
|
||||
'__MATHJAX_VERSION__', mathjax_version, 1).replace(
|
||||
'__CALIBRE_VERSION__', __version__, 1).encode('utf-8')
|
||||
'__CALIBRE_VERSION__', __version__, 1).replace(
|
||||
'__DARK_LINK_COLOR__', dark_link_color, 1).encode('utf-8')
|
||||
with lopen(os.path.join(base, 'index.html'), 'rb') as f:
|
||||
html = f.read().replace(b'RESET_STYLES', reset, 1).replace(b'ICONS', icons, 1).replace(b'MAIN_JS', js, 1)
|
||||
|
||||
|
@ -7,6 +7,8 @@ from encodings import hexlify
|
||||
from gettext import gettext as _, register_callback, gettext as gt
|
||||
|
||||
_boss = None
|
||||
dark_link_color = '__DARK_LINK_COLOR__'
|
||||
|
||||
|
||||
def set_boss(b):
|
||||
nonlocal _boss
|
||||
@ -71,7 +73,7 @@ register_callback(def():
|
||||
scheme.name = gt(scheme.name)
|
||||
# set the system colors if in dark mode
|
||||
if window.matchMedia and window.matchMedia('(prefers-color-scheme: dark)').matches:
|
||||
set_system_colors({'background': '#111', 'foreground': '#ddd', 'link': '#6cb4ee'})
|
||||
set_system_colors({'background': '#111', 'foreground': '#ddd', 'link': dark_link_color})
|
||||
)
|
||||
|
||||
runtime = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user