For the upcoming release of Sigil, we have added some capability to use dark mode because for some end-users who use plugins, the white background of a plugin gui elements may be a bit jarring under dark mode.
For plugins using tk widgets on macOSX, the tk widgets will automatically take on the dark mode of macOS as long as a recent (version 8.6.10 or later) release of TCl/Tk is installed on the system and Python 3.7 has been compiled against it. The next macOS release of Sigil will have been properly compiled to support dark mode. So macOS users with a recent Tcl/Tk version should get dark mode with no further work.
For plugins that use pyqt5 (or tk on platforms other than macOS), we have extended the plugin interface to provide some colour related information as follows:
Code:
# New in Sigil 1.1
# ----------------
# returns "light" or "dark"
def colorMode(self):
return self._w.colorMode()
# returns color as css or javascript hex color string "#xxxxxx"
# acccepts the following color roles in a case insensitive manner:
# "Window", "Base", "Text", "Highlight", "HighlightedText"
def color(self, role):
return self._w.color(role)
Sigil master now supports these routines for bk.launcher_version() >= 20200117:
Plugin developers will be able to determine if the system/Sigil is using dark or light mode and get some basic colour information (#XXXXXX). Using this additional information, plugin developers could change their gui to use these colours (in either or both light and dark modes). The colour roles used here match the colour roles used in Qt. See QPalette and etc.
Hope this helps,
KevinH and DiapDealer