diff --git a/spyder/utils/ipython/style.py b/spyder/utils/ipython/style.py index 03558be28b9..d2560ab14b8 100644 --- a/spyder/utils/ipython/style.py +++ b/spyder/utils/ipython/style.py @@ -49,7 +49,6 @@ def give_font_style(is_italic): in_prompt_color = 'lime' out_prompt_color = 'red' background_color = color_scheme['background'] - selection_background_color = '#ccc' error_color = 'red' in_prompt_number_font_weight = 'bold' out_prompt_number_font_weight = 'bold' @@ -59,7 +58,6 @@ def give_font_style(is_italic): sheet = """QPlainTextEdit, QTextEdit, ControlWidget {{ color: {} ; background-color: {}; - selection-background-color: {} }} .error {{ color: {}; }} .in-prompt {{ color: {}; }} @@ -70,7 +68,6 @@ def give_font_style(is_italic): """ sheet_formatted = sheet.format(font_color, background_color, - selection_background_color, error_color, in_prompt_color, in_prompt_color, in_prompt_number_font_weight, diff --git a/spyder/widgets/ipythonconsole/shell.py b/spyder/widgets/ipythonconsole/shell.py index bed2d395b6f..619697e8f64 100644 --- a/spyder/widgets/ipythonconsole/shell.py +++ b/spyder/widgets/ipythonconsole/shell.py @@ -17,6 +17,7 @@ from spyder.config.gui import config_shortcut from spyder.py3compat import to_text_string from spyder.utils import programs +from spyder.utils import syntaxhighlighters as sh from spyder.utils.ipython.style import create_qss_style, create_style_class from spyder.widgets.ipythonconsole import (ControlWidget, DebuggingWidget, HelpWidget, NamepaceBrowserWidget, @@ -70,6 +71,11 @@ def __init__(self, ipyclient, additional_options, interpreter_versions, # To save kernel replies in silent execution self._kernel_reply = None + # Set the color of the matched parentheses here since the qtconsole + # uses a hard-coded value that is not modified when the color scheme is + # set in the qtconsole constructor. See issue #4806. + self.set_bracket_matcher_color_scheme(self.syntax_style) + #---- Public API ---------------------------------------------------------- def set_exit_callback(self): """Set exit callback for this shell.""" @@ -110,9 +116,16 @@ def get_cwd(self): return else: self.silent_exec_method(code) + + def set_bracket_matcher_color_scheme(self, color_scheme): + """Set color scheme for matched parentheses.""" + bsh = sh.BaseSH(parent=self, color_scheme=color_scheme) + mpcolor = bsh.get_matched_p_color() + self._bracket_matcher.format.setBackground(mpcolor) def set_color_scheme(self, color_scheme): """Set color scheme of the shell.""" + self.set_bracket_matcher_color_scheme(color_scheme) self.style_sheet, dark_color = create_qss_style(color_scheme) self.syntax_style = color_scheme self._style_sheet_changed()