From d9ed43d5e02cd2f6d5b434e825654c4e644046a4 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Sat, 6 Jan 2024 13:46:16 +0100 Subject: [PATCH 1/2] Deprecate more complicated way of defining colors. Keep simple with a dict. --- IPython/utils/coloransi.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/IPython/utils/coloransi.py b/IPython/utils/coloransi.py index 5a061f27332..8404798a4cc 100644 --- a/IPython/utils/coloransi.py +++ b/IPython/utils/coloransi.py @@ -10,6 +10,7 @@ import os +import warnings from IPython.utils.ipstruct import Struct @@ -114,8 +115,18 @@ class ColorScheme: name: str colors: Struct - def __init__(self,__scheme_name_,colordict=None,**colormap): + def __init__(self, __scheme_name_, colordict=None, **colormap): self.name = __scheme_name_ + if colormap: + warnings.warn( + "Passing each colors as a kwarg to ColorScheme is " + "considered for deprecation. Please pass a " + "dict as single dict as second parameter. If you are using this" + "Feature, please comment an subscribe to issue " + "https://github.com/ipython/ipython/issues/14304", + PendingDeprecationWarning, + stacklevel=2, + ) if colordict is None: self.colors = Struct(**colormap) else: From dad1cd55c02127e2e355bf78396a64fbeaf00497 Mon Sep 17 00:00:00 2001 From: M Bussonnier Date: Wed, 31 Jan 2024 01:46:09 -0800 Subject: [PATCH 2/2] Update IPython/utils/coloransi.py --- IPython/utils/coloransi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IPython/utils/coloransi.py b/IPython/utils/coloransi.py index 8404798a4cc..fb5e6a955c0 100644 --- a/IPython/utils/coloransi.py +++ b/IPython/utils/coloransi.py @@ -121,8 +121,8 @@ def __init__(self, __scheme_name_, colordict=None, **colormap): warnings.warn( "Passing each colors as a kwarg to ColorScheme is " "considered for deprecation. Please pass a " - "dict as single dict as second parameter. If you are using this" - "Feature, please comment an subscribe to issue " + "a single dict as second parameter. If you are using this" + "feature, please comment an subscribe to issue " "https://github.com/ipython/ipython/issues/14304", PendingDeprecationWarning, stacklevel=2,