|
1 # -*- coding: utf-8 -*- |
|
2 """ |
|
3 pygments.styles.solarized |
|
4 ~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
5 |
|
6 Solarized by Camil Staps |
|
7 |
|
8 A Pygments style for the Solarized themes (licensed under MIT). |
|
9 See: https://github.com/altercation/solarized |
|
10 |
|
11 :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. |
|
12 :license: BSD, see LICENSE for details. |
|
13 """ |
|
14 |
|
15 from pygments.style import Style |
|
16 from pygments.token import Comment, Error, Generic, Keyword, Name, Number, \ |
|
17 Operator, String, Token |
|
18 |
|
19 |
|
20 def make_style(colors): |
|
21 return { |
|
22 Token: colors['base0'], |
|
23 |
|
24 Comment: 'italic ' + colors['base01'], |
|
25 Comment.Hashbang: colors['base01'], |
|
26 Comment.Multiline: colors['base01'], |
|
27 Comment.Preproc: 'noitalic ' + colors['magenta'], |
|
28 Comment.PreprocFile: 'noitalic ' + colors['base01'], |
|
29 |
|
30 Keyword: colors['green'], |
|
31 Keyword.Constant: colors['cyan'], |
|
32 Keyword.Declaration: colors['cyan'], |
|
33 Keyword.Namespace: colors['orange'], |
|
34 Keyword.Type: colors['yellow'], |
|
35 |
|
36 Operator: colors['base01'], |
|
37 Operator.Word: colors['green'], |
|
38 |
|
39 Name.Builtin: colors['blue'], |
|
40 Name.Builtin.Pseudo: colors['blue'], |
|
41 Name.Class: colors['blue'], |
|
42 Name.Constant: colors['blue'], |
|
43 Name.Decorator: colors['blue'], |
|
44 Name.Entity: colors['blue'], |
|
45 Name.Exception: colors['blue'], |
|
46 Name.Function: colors['blue'], |
|
47 Name.Function.Magic: colors['blue'], |
|
48 Name.Label: colors['blue'], |
|
49 Name.Namespace: colors['blue'], |
|
50 Name.Tag: colors['blue'], |
|
51 Name.Variable: colors['blue'], |
|
52 Name.Variable.Global:colors['blue'], |
|
53 Name.Variable.Magic: colors['blue'], |
|
54 |
|
55 String: colors['cyan'], |
|
56 String.Doc: colors['base01'], |
|
57 String.Regex: colors['orange'], |
|
58 |
|
59 Number: colors['cyan'], |
|
60 |
|
61 Generic.Deleted: colors['red'], |
|
62 Generic.Emph: 'italic', |
|
63 Generic.Error: colors['red'], |
|
64 Generic.Heading: 'bold', |
|
65 Generic.Subheading: 'underline', |
|
66 Generic.Inserted: colors['green'], |
|
67 Generic.Strong: 'bold', |
|
68 Generic.Traceback: colors['blue'], |
|
69 |
|
70 Error: 'bg:' + colors['red'], |
|
71 } |
|
72 |
|
73 |
|
74 DARK_COLORS = { |
|
75 'base03': '#002b36', |
|
76 'base02': '#073642', |
|
77 'base01': '#586e75', |
|
78 'base00': '#657b83', |
|
79 'base0': '#839496', |
|
80 'base1': '#93a1a1', |
|
81 'base2': '#eee8d5', |
|
82 'base3': '#fdf6e3', |
|
83 'yellow': '#b58900', |
|
84 'orange': '#cb4b16', |
|
85 'red': '#dc322f', |
|
86 'magenta': '#d33682', |
|
87 'violet': '#6c71c4', |
|
88 'blue': '#268bd2', |
|
89 'cyan': '#2aa198', |
|
90 'green': '#859900', |
|
91 } |
|
92 |
|
93 LIGHT_COLORS = { |
|
94 'base3': '#002b36', |
|
95 'base2': '#073642', |
|
96 'base1': '#586e75', |
|
97 'base0': '#657b83', |
|
98 'base00': '#839496', |
|
99 'base01': '#93a1a1', |
|
100 'base02': '#eee8d5', |
|
101 'base03': '#fdf6e3', |
|
102 'yellow': '#b58900', |
|
103 'orange': '#cb4b16', |
|
104 'red': '#dc322f', |
|
105 'magenta': '#d33682', |
|
106 'violet': '#6c71c4', |
|
107 'blue': '#268bd2', |
|
108 'cyan': '#2aa198', |
|
109 'green': '#859900', |
|
110 } |
|
111 |
|
112 |
|
113 class SolarizedDarkStyle(Style): |
|
114 """ |
|
115 The solarized style, dark. |
|
116 """ |
|
117 |
|
118 styles = make_style(DARK_COLORS) |
|
119 background_color = DARK_COLORS['base03'] |
|
120 highlight_color = DARK_COLORS['base02'] |
|
121 |
|
122 |
|
123 class SolarizedLightStyle(SolarizedDarkStyle): |
|
124 """ |
|
125 The solarized style, light. |
|
126 """ |
|
127 |
|
128 styles = make_style(LIGHT_COLORS) |
|
129 background_color = LIGHT_COLORS['base03'] |
|
130 highlight_color = LIGHT_COLORS['base02'] |