From ceeb774e12bc8c206ce66e0c3e2707ef8ae48363 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Sat, 4 Dec 2021 20:52:23 +0100 Subject: [PATCH 1/4] override RichJupyterWidget._get_colors() because we have a custom style --- spyder/plugins/ipythonconsole/widgets/shell.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spyder/plugins/ipythonconsole/widgets/shell.py b/spyder/plugins/ipythonconsole/widgets/shell.py index 0276ffd3e93..1ffc9014d4e 100644 --- a/spyder/plugins/ipythonconsole/widgets/shell.py +++ b/spyder/plugins/ipythonconsole/widgets/shell.py @@ -23,6 +23,7 @@ # Local imports from spyder.config.base import ( _, is_pynsist, running_in_mac_app, running_under_pytest) +from spyder.config.gui import get_color_scheme from spyder.py3compat import to_text_string from spyder.utils.palette import SpyderPalette from spyder.utils import encoding @@ -945,6 +946,17 @@ def _syntax_style_changed(self): else: self._highlighter.set_style_sheet(self.style_sheet) + def _get_colors(self, color): + """ + Get a color as qtconsole.styles.get_colors() would return from + a builtin Pygments style + """ + color_scheme = get_color_scheme(self.syntax_style) + return dict( + bgcolor = color_scheme['background'], + select = color_scheme['background'], + fgcolor = color_scheme['normal'][0])[color] + def _prompt_started_hook(self): """Emit a signal when the prompt is ready.""" if not self._reading: From a43307653e738e35f8c600d5b4e13857c4b80f03 Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Sat, 4 Dec 2021 21:02:08 +0100 Subject: [PATCH 2/4] fix pep8speaks --- spyder/plugins/ipythonconsole/widgets/shell.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spyder/plugins/ipythonconsole/widgets/shell.py b/spyder/plugins/ipythonconsole/widgets/shell.py index 1ffc9014d4e..eb841a36348 100644 --- a/spyder/plugins/ipythonconsole/widgets/shell.py +++ b/spyder/plugins/ipythonconsole/widgets/shell.py @@ -953,9 +953,9 @@ def _get_colors(self, color): """ color_scheme = get_color_scheme(self.syntax_style) return dict( - bgcolor = color_scheme['background'], - select = color_scheme['background'], - fgcolor = color_scheme['normal'][0])[color] + bgcolor=color_scheme['background'], + select=color_scheme['background'], + fgcolor=color_scheme['normal'][0])[color] def _prompt_started_hook(self): """Emit a signal when the prompt is ready.""" From 07988e6687f83fcf4260c9a4b589b5543d32ce1e Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Tue, 7 Dec 2021 14:29:05 +0100 Subject: [PATCH 3/4] Add period Co-authored-by: Carlos Cordoba --- spyder/plugins/ipythonconsole/widgets/shell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyder/plugins/ipythonconsole/widgets/shell.py b/spyder/plugins/ipythonconsole/widgets/shell.py index eb841a36348..cefd06899d2 100644 --- a/spyder/plugins/ipythonconsole/widgets/shell.py +++ b/spyder/plugins/ipythonconsole/widgets/shell.py @@ -949,7 +949,7 @@ def _syntax_style_changed(self): def _get_colors(self, color): """ Get a color as qtconsole.styles.get_colors() would return from - a builtin Pygments style + a builtin Pygments style. """ color_scheme = get_color_scheme(self.syntax_style) return dict( From cb81a62bc125863ab449352ec753cd249820023d Mon Sep 17 00:00:00 2001 From: Ben Greiner Date: Sun, 13 Feb 2022 16:21:19 -0800 Subject: [PATCH 4/4] rename to _get_color Co-authored-by: Carlos Cordoba --- spyder/plugins/ipythonconsole/widgets/shell.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spyder/plugins/ipythonconsole/widgets/shell.py b/spyder/plugins/ipythonconsole/widgets/shell.py index cefd06899d2..477c5a40ade 100644 --- a/spyder/plugins/ipythonconsole/widgets/shell.py +++ b/spyder/plugins/ipythonconsole/widgets/shell.py @@ -946,9 +946,9 @@ def _syntax_style_changed(self): else: self._highlighter.set_style_sheet(self.style_sheet) - def _get_colors(self, color): + def _get_color(self, color): """ - Get a color as qtconsole.styles.get_colors() would return from + Get a color as qtconsole.styles._get_color() would return from a builtin Pygments style. """ color_scheme = get_color_scheme(self.syntax_style)