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