Repository: spyder-ide/spyder

Issue:
Spyder dark theme overrides background color set in syntax highlighting theme, except behind text
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->


## Problem Description

As discussed in #8020 and part of #8068 .

The background color of the Editor pane, as well as the syntax color scheme preview in preferences, does not change as it should with the "Background" color of the syntax highlighting theme, but rather only the background surrounding the actual text characters. This works properly with the light UI theme. The issue reporting dialog editor has the same problem, except that it always uses the light theme so it looks even worse. Examples:

Spyder dark theme:

![image.png](https://images.zenhubusercontent.com/5aac63014b5806bc2bcb3680/10e9d0f7-6621-445a-ac89-62ee734c544f)

Zenburn:

![image.png](https://images.zenhubusercontent.com/5aac63014b5806bc2bcb3680/b339d211-6746-40fd-bb9a-a86daa4dbabb)

Syntax theme preview:

![image.png](https://images.zenhubusercontent.com/5aac63014b5806bc2bcb3680/85c31a77-6e8b-4964-98f8-0e999c295a22)

Issue report:

![image.png](https://images.zenhubusercontent.com/5aac63014b5806bc2bcb3680/2b8b245d-2333-4a01-9b84-956f832dc8ae)



Discussion:
I know how to fix this. I'll do it once PR #8020 is merged.
@ccordoba12 Also an issue in the internal console, which uses the default syntax highlighting scheme like the issue reporter dialog:

![image.png](https://images.zenhubusercontent.com/5aac63014b5806bc2bcb3680/03517ce6-fb91-4061-aac2-a1a5457c705b)

Resolving patch:
diff --git a/spyder/plugins/editor/widgets/base.py b/spyder/plugins/editor/widgets/base.py
--- a/spyder/plugins/editor/widgets/base.py
+++ b/spyder/plugins/editor/widgets/base.py
@@ -345,12 +345,11 @@ def set_palette(self, background, foreground):
 
         # Set the right background color when changing color schemes
         # or creating new Editor windows. This seems to be a Qt bug.
-        # Fixes Issue 2028
-        if sys.platform == 'darwin':
-            if self.objectName():
-                style = "QPlainTextEdit#%s {background: %s; color: %s;}" % \
-                        (self.objectName(), background.name(), foreground.name())
-                self.setStyleSheet(style)
+        # Fixes Issue 2028 and 8069
+        if self.objectName():
+            style = "QPlainTextEdit#%s {background: %s; color: %s;}" % \
+                    (self.objectName(), background.name(), foreground.name())
+            self.setStyleSheet(style)
 
 
     #------Extra selections
diff --git a/spyder/plugins/editor/widgets/codeeditor.py b/spyder/plugins/editor/widgets/codeeditor.py
--- a/spyder/plugins/editor/widgets/codeeditor.py
+++ b/spyder/plugins/editor/widgets/codeeditor.py
@@ -297,17 +297,18 @@ def __init__(self, parent=None):
         # We use these object names to set the right background
         # color when changing color schemes or creating new
         # Editor windows. This seems to be a Qt bug.
-        # Fixes Issue 2028
-        if sys.platform == 'darwin':
-            plugin_name = repr(parent)
-            if 'editor' in plugin_name.lower():
-                self.setObjectName('editor')
-            elif 'help' in plugin_name.lower():
-                self.setObjectName('help')
-            elif 'historylog' in plugin_name.lower():
-                self.setObjectName('historylog')
-            elif 'configdialog' in plugin_name.lower():
-                self.setObjectName('configdialog')
+        # Fixes issues 2028 and 8069
+        plugin_name = repr(parent)
+        if 'editor' in plugin_name.lower():
+            self.setObjectName('editor')
+        elif 'help' in plugin_name.lower():
+            self.setObjectName('help')
+        elif 'historylog' in plugin_name.lower():
+            self.setObjectName('historylog')
+        elif 'configdialog' in plugin_name.lower():
+            self.setObjectName('configdialog')
+        elif 'errordialog' in plugin_name.lower():
+            self.setObjectName('errordialog')
 
         # Caret (text cursor)
         self.setCursorWidth( CONF.get('main', 'cursor/width') )
diff --git a/spyder/widgets/reporterror.py b/spyder/widgets/reporterror.py
--- a/spyder/widgets/reporterror.py
+++ b/spyder/widgets/reporterror.py
@@ -21,6 +21,7 @@
 from spyder import __project_url__, __trouble_url__
 from spyder.config.base import _
 from spyder.config.gui import get_font
+from spyder.config.gui import CONF
 from spyder.utils import icon_manager as ima
 from spyder.utils.qthelpers import restore_keyevent
 from spyder.widgets.github.backend import GithubBackend
@@ -46,7 +47,8 @@ def __init__(self, parent=None):
         # Editor options
         self.setup_editor(
             language='md',
-            color_scheme='Scintilla',
+            color_scheme=CONF.get('color_schemes',
+                                  'selected'),
             linenumbers=False,
             scrollflagarea=False,
             wrap=True,


Test patch: