Allow CALIBRE_USE_DARK_PALETTE override registry setting on windows

This commit is contained in:
Kovid Goyal 2019-12-08 20:40:44 +05:30
parent 0a1d4cfcbf
commit d974b2f39c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 14 additions and 11 deletions

View File

@ -40,6 +40,8 @@ Environment variables
the system theme -- beware of crashes and hangs. the system theme -- beware of crashes and hangs.
* ``CALIBRE_SHOW_DEPRECATION_WARNINGS`` - Causes calibre to print deprecation warnings to stdout. Useful for calibre developers. * ``CALIBRE_SHOW_DEPRECATION_WARNINGS`` - Causes calibre to print deprecation warnings to stdout. Useful for calibre developers.
* ``CALIBRE_NO_DEFAULT_PROGRAMS`` - Prevent calibre from automatically registering the filetypes it is capable of handling with Windows. * ``CALIBRE_NO_DEFAULT_PROGRAMS`` - Prevent calibre from automatically registering the filetypes it is capable of handling with Windows.
* ``CALIBRE_USE_DARK_PALETTE`` - Set it to ``1`` to have calibre use dark colors and ``0`` for normal colors (ignored on macOS).
On Windows 10 in the absence of this variable, the windows system preference for dark colors is used.
* ``SYSFS_PATH`` - Use if sysfs is mounted somewhere other than /sys * ``SYSFS_PATH`` - Use if sysfs is mounted somewhere other than /sys
* ``http_proxy``, ``https_proxy`` - Used on linux to specify an HTTP(S) proxy * ``http_proxy``, ``https_proxy`` - Used on linux to specify an HTTP(S) proxy
@ -110,4 +112,3 @@ Customizing calibre with plugins
calibre has a very modular design. Almost all functionality in calibre comes in the form of plugins. Plugins are used for conversion, for downloading news (though these are called recipes), for various components of the user interface, to connect to different devices, to process files when adding them to calibre and so on. You can get a complete list of all the built-in plugins in calibre by going to :guilabel:`Preferences->Advanced->Plugins`. calibre has a very modular design. Almost all functionality in calibre comes in the form of plugins. Plugins are used for conversion, for downloading news (though these are called recipes), for various components of the user interface, to connect to different devices, to process files when adding them to calibre and so on. You can get a complete list of all the built-in plugins in calibre by going to :guilabel:`Preferences->Advanced->Plugins`.
You can write your own plugins to customize and extend the behavior of calibre. The plugin architecture in calibre is very simple, see the tutorial :ref:`pluginstutorial`. You can write your own plugins to customize and extend the behavior of calibre. The plugin architecture in calibre is very simple, see the tutorial :ref:`pluginstutorial`.

View File

@ -1021,10 +1021,12 @@ class Application(QApplication):
using_calibre_style = True using_calibre_style = True
if using_calibre_style: if using_calibre_style:
use_dark_palette = False use_dark_palette = False
if 'CALIBRE_USE_DARK_PALETTE' in os.environ:
if not isosx:
use_dark_palette = os.environ['CALIBRE_USE_DARK_PALETTE'] != '0'
else:
if iswindows: if iswindows:
use_dark_palette = windows_is_system_dark_mode_enabled() use_dark_palette = windows_is_system_dark_mode_enabled()
elif not isosx:
use_dark_palette = os.environ.get('CALIBRE_USE_DARK_PALETTE') == '1'
if use_dark_palette: if use_dark_palette:
self.set_dark_mode_palette() self.set_dark_mode_palette()