fix white flash on webview load

This commit is contained in:
Damien Elmes 2020-01-23 15:27:30 +10:00
parent 7dcbc7efec
commit 982aca0c99

View file

@ -247,6 +247,8 @@ class AnkiWebView(QWebEngineView): # type: ignore
return 3 return 3
def _getWindowColor(self): def _getWindowColor(self):
if theme_manager.night_mode:
return theme_manager.qcolor("window-bg")
if isMac: if isMac:
# standard palette does not return correct window color on macOS # standard palette does not return correct window color on macOS
return QColor("#ececec") return QColor("#ececec")
@ -317,7 +319,7 @@ div[contenteditable="true"]:focus {
<title>{}</title> <title>{}</title>
<style> <style>
body {{ zoom: {}; background: {}; {} }} body {{ zoom: {}; {} }}
{} {}
</style> </style>
@ -328,7 +330,6 @@ body {{ zoom: {}; background: {}; {} }}
</html>""".format( </html>""".format(
self.title, self.title,
self.zoomFactor(), self.zoomFactor(),
self._getWindowColor().name(),
fontspec, fontspec,
widgetspec, widgetspec,
head, head,