dot/ipython-config.py: Configure modern IPython syntax colouring.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 15 Jul 2017 00:15:00 +0000 (01:15 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 15 Jul 2017 14:01:29 +0000 (15:01 +0100)
This ought to match my Emacs display, but numbers seem to come out
somewhat lime-green rather than yellow.

dot/ipython-config.py

index 63e7de4..3377a2b 100644 (file)
@@ -1,7 +1,9 @@
 ### -*-python -*-
 
+import pygments as PYG
 c = get_config()
 
+## Simple stuff.
 c.InteractiveShell.autocall = 0
 c.InteractiveShell.autoindent = True
 c.InteractiveShell.automagic = False
@@ -12,3 +14,32 @@ c.InteractiveShell.colors = 'Linux'
 c.TerminalIPythonApp.display_banner = False
 c.TerminalInteractiveShell.confirm_exit = False
 c.TerminalInteractiveShell.display_completions = 'readlinelike'
+
+## Syntax colouring.
+T = PYG.token
+c.TerminalInteractiveShell.highlighting_style = 'emacs'
+c.TerminalInteractiveShell.highlighting_style_overrides = {
+  T.Keyword: 'bold #fff',
+  T.Comment: 'italic #54ff9f',
+  T.Literal.Number: '#adff2f',
+  T.Literal.String: '#87ceff',
+  T.Literal.String.Escape: '#87ceff',
+  T.Literal.String.Interpol: '#87ceff',
+  T.Name: '#fff',
+  T.Name.Builtin: '#fff',
+  T.Name.Class: '#fff',
+  T.Name.Constant: 'italic #fff',
+  T.Name.Decorator: '#fff',
+  T.Name.Function: '#fff',
+  T.Name.Function.Magic: '#fff',
+  T.Name.Label: '#fff',
+  T.Name.Namespace: '#fff',
+  T.Name.Variable: '#fff',
+  T.Name.Variable.Class: '#fff',
+  T.Name.Variable.Global: '#fff',
+  T.Name.Variable.Instance: '#fff',
+  T.Name.Variable.Magic: '#fff',
+  T.Operator: '#eec591',
+  T.Operator.Word: 'bold #fff',
+  T.Punctuation: '#eec591'
+}