Repository: spyder-ide/spyder

Issue:
Set dark color for blank html template
For a brief moment at startup you can see that the IPython Console and the Help pane show a white background in the dark theme. I think this happens because our `blank.html` template in

    spyder/plugins/ipythonconsole/assets/templates/blank.html

is a blank (which defaults to white) html page.

So I think we need to make that page to follow the dark theme when it's in use by creating a new `blank_dark.html` page and using it accordingly.

@dalthviz, please work on this one.


Discussion:

Resolving patch:
diff --git a/spyder/plugins/help/widgets.py b/spyder/plugins/help/widgets.py
--- a/spyder/plugins/help/widgets.py
+++ b/spyder/plugins/help/widgets.py
@@ -14,14 +14,22 @@
 # Third party imports
 from qtpy.QtCore import  Signal
 from qtpy.QtWidgets import QSizePolicy, QVBoxLayout, QWidget
+from qtpy.QtGui import QColor
+from qtpy.QtWebEngineWidgets import WEBENGINE
 
 # Local imports
+from spyder.config.gui import is_dark_interface
 from spyder.py3compat import to_text_string
 from spyder.widgets.browser import FrameWebView
 from spyder.widgets.comboboxes import EditableComboBox
 from spyder.widgets.findreplace import FindReplace
 from spyder.plugins.editor.widgets import codeeditor
 
+if is_dark_interface():
+    MAIN_BG_COLOR = '#19232D'
+else:
+    MAIN_BG_COLOR = 'white'
+
 
 class ObjectComboBox(EditableComboBox):
     """
@@ -88,6 +96,12 @@ def __init__(self, parent):
         QWidget.__init__(self, parent)
 
         self.webview = FrameWebView(self)
+        if WEBENGINE:
+            self.webview.web_widget.page().setBackgroundColor(
+                QColor(MAIN_BG_COLOR))
+        else:
+            self.webview.web_widget.setBackgroundColor(
+                QColor(MAIN_BG_COLOR))
         self.find_widget = FindReplace(self)
         self.find_widget.set_editor(self.webview.web_widget)
         self.find_widget.hide()
diff --git a/spyder/plugins/ipythonconsole/widgets/client.py b/spyder/plugins/ipythonconsole/widgets/client.py
--- a/spyder/plugins/ipythonconsole/widgets/client.py
+++ b/spyder/plugins/ipythonconsole/widgets/client.py
@@ -26,9 +26,10 @@
 
 # Third party imports (qtpy)
 from qtpy.QtCore import QUrl, QTimer, Signal, Slot
-from qtpy.QtGui import QKeySequence
+from qtpy.QtGui import QKeySequence, QColor
 from qtpy.QtWidgets import (QHBoxLayout, QLabel, QMenu, QMessageBox,
                             QToolButton, QVBoxLayout, QWidget)
+from qtpy.QtWebEngineWidgets import WEBENGINE
 
 # Local imports
 from spyder.config.base import (_, get_image_path, get_module_source_path,
@@ -64,6 +65,11 @@
 LOADING = open(osp.join(TEMPLATES_PATH, 'loading.html')).read()
 KERNEL_ERROR = open(osp.join(TEMPLATES_PATH, 'kernel_error.html')).read()
 
+if is_dark_interface():
+    MAIN_BG_COLOR = '#19232D'
+else:
+    MAIN_BG_COLOR = 'white'
+
 try:
     time.monotonic  # time.monotonic new in 3.3
 except AttributeError:
@@ -150,7 +156,12 @@ def __init__(self, plugin, id_,
                                        external_kernel=external_kernel,
                                        local_kernel=True)
         self.infowidget = WebView(self)
+        if WEBENGINE:
+            self.infowidget.page().setBackgroundColor(QColor(MAIN_BG_COLOR))
+        else:
+            self.infowidget.setBackgroundColor(QColor(MAIN_BG_COLOR))
         self.set_infowidget_font()
+        self.blank_page = self._create_blank_page()
         self.loading_page = self._create_loading_page()
         self._show_loading_page()
 
@@ -671,6 +682,12 @@ def _create_loading_page(self):
                                            message=message)
         return page
 
+    def _create_blank_page(self):
+        """Create html page to show while the kernel is starting"""
+        loading_template = Template(BLANK)
+        page = loading_template.substitute(css_path=self.css_path)
+        return page
+
     def _show_loading_page(self):
         """Show animation while the kernel is loading."""
         self.shellwidget.hide()
@@ -682,7 +699,7 @@ def _hide_loading_page(self):
         """Hide animation shown while the kernel is loading."""
         self.infowidget.hide()
         self.shellwidget.show()
-        self.infowidget.setHtml(BLANK,
+        self.infowidget.setHtml(self.blank_page,
                                 QUrl.fromLocalFile(self.css_path))
         self.shellwidget.sig_prompt_ready.disconnect(self._hide_loading_page)
 


Test patch: