MCPcopy Create free account
hub / github.com/ipython/ipython / set_active_scheme

Method set_active_scheme

IPython/utils/coloransi.py:164–187  ·  view source on GitHub ↗

Set the currently active scheme. Names are by default compared in a case-insensitive way, but this can be changed by setting the parameter case_sensitive to true.

(self,scheme,case_sensitive=0)

Source from the content-addressed store, hash-verified

162 self[new_scheme.name] = new_scheme
163
164 def set_active_scheme(self,scheme,case_sensitive=0):
165 """Set the currently active scheme.
166
167 Names are by default compared in a case-insensitive way, but this can
168 be changed by setting the parameter case_sensitive to true."""
169
170 scheme_names = list(self.keys())
171 if case_sensitive:
172 valid_schemes = scheme_names
173 scheme_test = scheme
174 else:
175 valid_schemes = [s.lower() for s in scheme_names]
176 scheme_test = scheme.lower()
177 try:
178 scheme_idx = valid_schemes.index(scheme_test)
179 except ValueError:
180 raise ValueError('Unrecognized color scheme: ' + scheme + \
181 '\nValid schemes: '+str(scheme_names).replace("'', ",''))
182 else:
183 active = scheme_names[scheme_idx]
184 self.active_scheme_name = active
185 self.active_colors = self[active].colors
186 # Now allow using '' as an index for the current active scheme
187 self[''] = self[active]

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected