##// END OF EJS Templates
Add true_color option for prompt_toolkit
Jacob Niehus -
Show More
@@ -14,7 +14,7 b' from traitlets import Bool, Unicode, Dict, Integer, observe, Instance, Type, def'
14 from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
14 from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
15 from prompt_toolkit.filters import (HasFocus, Condition, IsDone)
15 from prompt_toolkit.filters import (HasFocus, Condition, IsDone)
16 from prompt_toolkit.history import InMemoryHistory
16 from prompt_toolkit.history import InMemoryHistory
17 from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop, create_prompt_layout
17 from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop, create_prompt_layout, create_output
18 from prompt_toolkit.interface import CommandLineInterface
18 from prompt_toolkit.interface import CommandLineInterface
19 from prompt_toolkit.key_binding.manager import KeyBindingManager
19 from prompt_toolkit.key_binding.manager import KeyBindingManager
20 from prompt_toolkit.layout.processors import ConditionalProcessor, HighlightMatchingBracketProcessor
20 from prompt_toolkit.layout.processors import ConditionalProcessor, HighlightMatchingBracketProcessor
@@ -142,6 +142,13 b' class TerminalInteractiveShell(InteractiveShell):'
142 help="Override highlighting format for specific tokens"
142 help="Override highlighting format for specific tokens"
143 ).tag(config=True)
143 ).tag(config=True)
144
144
145 true_color = Bool(False,
146 help=("Use 24bit colors instead of 256 colors in prompt highlighting. "
147 "If your terminal supports true color, the following command "
148 "should print 'TRUECOLOR' in orange: "
149 "printf \"\\x1b[38;2;255;100;0mTRUECOLOR\\x1b[0m\\n\"")
150 ).tag(config=True)
151
145 editor = Unicode(get_default_editor(),
152 editor = Unicode(get_default_editor(),
146 help="Set the editor used by IPython (default to $EDITOR/vi/notepad)."
153 help="Set the editor used by IPython (default to $EDITOR/vi/notepad)."
147 ).tag(config=True)
154 ).tag(config=True)
@@ -235,7 +242,9 b' class TerminalInteractiveShell(InteractiveShell):'
235 **self._layout_options()
242 **self._layout_options()
236 )
243 )
237 self._eventloop = create_eventloop(self.inputhook)
244 self._eventloop = create_eventloop(self.inputhook)
238 self.pt_cli = CommandLineInterface(self._pt_app, eventloop=self._eventloop)
245 self.pt_cli = CommandLineInterface(
246 self._pt_app, eventloop=self._eventloop,
247 output=create_output(true_color=self.true_color))
239
248
240 def _make_style_from_name(self, name):
249 def _make_style_from_name(self, name):
241 """
250 """
General Comments 0
You need to be logged in to leave comments. Login now