Show More
@@ -7,6 +7,7 b' from prompt_toolkit.interface import CommandLineInterface' | |||
|
7 | 7 | from prompt_toolkit.key_binding.manager import KeyBindingManager |
|
8 | 8 | from prompt_toolkit.keys import Keys |
|
9 | 9 | from prompt_toolkit.layout.lexers import PygmentsLexer |
|
10 | from prompt_toolkit.styles import PygmentsStyle | |
|
10 | 11 | |
|
11 | 12 | from pygments.lexers import Python3Lexer |
|
12 | 13 | from pygments.token import Token |
@@ -33,7 +34,7 b' class PTInteractiveShell(InteractiveShell):' | |||
|
33 | 34 | def get_prompt_tokens(self, cli): |
|
34 | 35 | return [ |
|
35 | 36 | (Token.Prompt, 'In ['), |
|
36 | (Token.Prompt, str(self.execution_count)), | |
|
37 | (Token.PromptNum, str(self.execution_count)), | |
|
37 | 38 | (Token.Prompt, ']: '), |
|
38 | 39 | ] |
|
39 | 40 | |
@@ -68,12 +69,20 b' class PTInteractiveShell(InteractiveShell):' | |||
|
68 | 69 | if cell and (cell != last_cell): |
|
69 | 70 | history.append(cell) |
|
70 | 71 | |
|
72 | style = PygmentsStyle.from_defaults({ | |
|
73 | Token.Prompt: '#009900', | |
|
74 | Token.PromptNum: '#00ff00 bold', | |
|
75 | Token.Number: '#007700', | |
|
76 | Token.Operator: '#bbbbbb', | |
|
77 | }) | |
|
78 | ||
|
71 | 79 | app = create_prompt_application(multiline=True, |
|
72 | 80 | lexer=PygmentsLexer(Python3Lexer), |
|
73 | 81 | get_prompt_tokens=self.get_prompt_tokens, |
|
74 | 82 | key_bindings_registry=kbmanager.registry, |
|
75 | 83 | history=history, |
|
76 | 84 | completer=IPythonPTCompleter(self.Completer), |
|
85 | style=style, | |
|
77 | 86 | ) |
|
78 | 87 | |
|
79 | 88 | self.pt_cli = CommandLineInterface(app) |
General Comments 0
You need to be logged in to leave comments.
Login now