-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipython_config.py
91 lines (75 loc) · 2.01 KB
/
ipython_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
from traitlets.config import get_config
from IPython.terminal import interactiveshell
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, Number, Token
BASE03 = '#002b36'
BASE02 = '#073642'
BASE01 = '#586e75'
BASE00 = '#657b83'
BASE0 = '#839496'
BASE1 = '#93a1a1'
BASE2 = '#eee8d5'
BASE3 = '#fdf6e3'
YELLOW = '#b58900'
ORANGE = '#cb4b16'
RED = '#dc322f'
MAGENTA = '#d33682'
VIOLET = '#6c71c4'
BLUE = '#268bd2'
CYAN = '#2aa198'
GREEN = '#859900'
dark = {
Comment: BASE01,
Name: BASE0,
}
light = {
Comment: BASE1,
Name: BASE00,
}
solarized_common = {
Keyword.Constant: CYAN,
Keyword.Declaration: BLUE,
Keyword: GREEN,
Name.Builtin.Pseudo: 'bold ' + BASE1,
Name.Builtin: YELLOW,
Name.Class: BLUE,
Name.Decorator: BLUE,
Name.Exception: YELLOW,
Name.Function: BLUE,
Number: CYAN,
Error: 'bold ' + RED,
String.Backtick: RED,
String.Char: CYAN,
String.Doc: CYAN,
String.Double: CYAN,
String.Escape: RED,
String.Heredoc: CYAN,
String.Interpol: RED,
String.Other: RED,
String.Regex: CYAN,
String.Single: CYAN,
String.Symbol: CYAN,
String: CYAN,
}
class Solarized(Style):
background_color = '#002b36'
class SolarizedLight(Solarized):
styles = {**solarized_common, **light}
class SolarizedDark(Solarized):
styles = {**solarized_common, **dark}
def get_style_by_name(name, original=interactiveshell.get_style_by_name):
if name.startswith('solarized'):
return SolarizedDark if name.endswith('dark') else SolarizedLight
else:
return original(name)
interactiveshell.get_style_by_name = get_style_by_name
c = get_config()
c.TerminalInteractiveShell.highlighting_style = 'solarized_dark'
c.TerminalInteractiveShell.highlighting_style_overrides = {
Token.Prompt: GREEN,
Token.PromptNum: 'bold ' + GREEN,
Token.OutPrompt: RED,
Token.OutPromptNum: 'bold ' + RED,
}
c.TerminalInteractiveShell.true_color = True
c.TerminalInteractiveShell.editing_mode = 'vi'