qingxu99 commited on
Commit
6137963
1 Parent(s): b3e5cdb

拯救一下之前的灾难性的代码配色

Browse files
Files changed (1) hide show
  1. theme.py +178 -68
theme.py CHANGED
@@ -137,6 +137,15 @@ advanced_css = """
137
 
138
  /* 行内代码的背景设为淡灰色,设定圆角和间距. */
139
  .markdown-body code {
 
 
 
 
 
 
 
 
 
140
  display: inline;
141
  white-space: break-spaces;
142
  border-radius: 6px;
@@ -144,8 +153,19 @@ advanced_css = """
144
  padding: .2em .4em .1em .4em;
145
  background-color: rgba(175,184,193,0.2);
146
  }
 
147
  /* 设定代码块的样式,包括背景颜色、内、外边距、圆角。 */
148
  .markdown-body pre code {
 
 
 
 
 
 
 
 
 
 
149
  display: block;
150
  overflow: auto;
151
  white-space: pre;
@@ -160,72 +180,162 @@ advanced_css = """
160
  if CODE_HIGHLIGHT:
161
  advanced_css += """
162
 
163
- .hll { background-color: #ffffcc }
164
- .c { color: #3D7B7B; font-style: italic } /* Comment */
165
- .err { border: 1px solid #FF0000 } /* Error */
166
- .k { color: hsl(197, 94%, 51%); font-weight: bold } /* Keyword */
167
- .o { color: #666666 } /* Operator */
168
- .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */
169
- .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */
170
- .cp { color: #9C6500 } /* Comment.Preproc */
171
- .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */
172
- .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */
173
- .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */
174
- .gd { color: #A00000 } /* Generic.Deleted */
175
- .ge { font-style: italic } /* Generic.Emph */
176
- .gr { color: #E40000 } /* Generic.Error */
177
- .gh { color: #000080; font-weight: bold } /* Generic.Heading */
178
- .gi { color: #008400 } /* Generic.Inserted */
179
- .go { color: #717171 } /* Generic.Output */
180
- .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
181
- .gs { font-weight: bold } /* Generic.Strong */
182
- .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
183
- .gt { color: #a9dd00 } /* Generic.Traceback */
184
- .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
185
- .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
186
- .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
187
- .kp { color: #008000 } /* Keyword.Pseudo */
188
- .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
189
- .kt { color: #B00040 } /* Keyword.Type */
190
- .m { color: #666666 } /* Literal.Number */
191
- .s { color: #BA2121 } /* Literal.String */
192
- .na { color: #687822 } /* Name.Attribute */
193
- .nb { color: #e5f8c3 } /* Name.Builtin */
194
- .nc { color: #ffad65; font-weight: bold } /* Name.Class */
195
- .no { color: #880000 } /* Name.Constant */
196
- .nd { color: #AA22FF } /* Name.Decorator */
197
- .ni { color: #717171; font-weight: bold } /* Name.Entity */
198
- .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */
199
- .nf { color: #f9f978 } /* Name.Function */
200
- .nl { color: #767600 } /* Name.Label */
201
- .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
202
- .nt { color: #008000; font-weight: bold } /* Name.Tag */
203
- .nv { color: #19177C } /* Name.Variable */
204
- .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
205
- .w { color: #bbbbbb } /* Text.Whitespace */
206
- .mb { color: #666666 } /* Literal.Number.Bin */
207
- .mf { color: #666666 } /* Literal.Number.Float */
208
- .mh { color: #666666 } /* Literal.Number.Hex */
209
- .mi { color: #666666 } /* Literal.Number.Integer */
210
- .mo { color: #666666 } /* Literal.Number.Oct */
211
- .sa { color: #BA2121 } /* Literal.String.Affix */
212
- .sb { color: #BA2121 } /* Literal.String.Backtick */
213
- .sc { color: #BA2121 } /* Literal.String.Char */
214
- .dl { color: #BA2121 } /* Literal.String.Delimiter */
215
- .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
216
- .s2 { color: #2bf840 } /* Literal.String.Double */
217
- .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */
218
- .sh { color: #BA2121 } /* Literal.String.Heredoc */
219
- .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */
220
- .sx { color: #008000 } /* Literal.String.Other */
221
- .sr { color: #A45A77 } /* Literal.String.Regex */
222
- .s1 { color: #BA2121 } /* Literal.String.Single */
223
- .ss { color: #19177C } /* Literal.String.Symbol */
224
- .bp { color: #008000 } /* Name.Builtin.Pseudo */
225
- .fm { color: #0000FF } /* Name.Function.Magic */
226
- .vc { color: #19177C } /* Name.Variable.Class */
227
- .vg { color: #19177C } /* Name.Variable.Global */
228
- .vi { color: #19177C } /* Name.Variable.Instance */
229
- .vm { color: #19177C } /* Name.Variable.Magic */
230
- .il { color: #666666 } /* Literal.Number.Integer.Long */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  """
 
137
 
138
  /* 行内代码的背景设为淡灰色,设定圆角和间距. */
139
  .markdown-body code {
140
+ display: inline;
141
+ white-space: break-spaces;
142
+ border-radius: 6px;
143
+ margin: 0 2px 0 2px;
144
+ padding: .2em .4em .1em .4em;
145
+ background-color: rgba(13, 17, 23, 0.95);
146
+ }
147
+
148
+ .dark .markdown-body code {
149
  display: inline;
150
  white-space: break-spaces;
151
  border-radius: 6px;
 
153
  padding: .2em .4em .1em .4em;
154
  background-color: rgba(175,184,193,0.2);
155
  }
156
+
157
  /* 设定代码块的样式,包括背景颜色、内、外边距、圆角。 */
158
  .markdown-body pre code {
159
+ display: block;
160
+ overflow: auto;
161
+ white-space: pre;
162
+ background-color: rgba(13, 17, 23, 0.95);
163
+ border-radius: 10px;
164
+ padding: 1em;
165
+ margin: 1em 2em 1em 0.5em;
166
+ }
167
+
168
+ .dark .markdown-body pre code {
169
  display: block;
170
  overflow: auto;
171
  white-space: pre;
 
180
  if CODE_HIGHLIGHT:
181
  advanced_css += """
182
 
183
+ .codehilite .hll { background-color: #6e7681 }
184
+ .codehilite .c { color: #8b949e; font-style: italic } /* Comment */
185
+ .codehilite .err { color: #f85149 } /* Error */
186
+ .codehilite .esc { color: #c9d1d9 } /* Escape */
187
+ .codehilite .g { color: #c9d1d9 } /* Generic */
188
+ .codehilite .k { color: #ff7b72 } /* Keyword */
189
+ .codehilite .l { color: #a5d6ff } /* Literal */
190
+ .codehilite .n { color: #c9d1d9 } /* Name */
191
+ .codehilite .o { color: #ff7b72; font-weight: bold } /* Operator */
192
+ .codehilite .x { color: #c9d1d9 } /* Other */
193
+ .codehilite .p { color: #c9d1d9 } /* Punctuation */
194
+ .codehilite .ch { color: #8b949e; font-style: italic } /* Comment.Hashbang */
195
+ .codehilite .cm { color: #8b949e; font-style: italic } /* Comment.Multiline */
196
+ .codehilite .cp { color: #8b949e; font-weight: bold; font-style: italic } /* Comment.Preproc */
197
+ .codehilite .cpf { color: #8b949e; font-style: italic } /* Comment.PreprocFile */
198
+ .codehilite .c1 { color: #8b949e; font-style: italic } /* Comment.Single */
199
+ .codehilite .cs { color: #8b949e; font-weight: bold; font-style: italic } /* Comment.Special */
200
+ .codehilite .gd { color: #ffa198; background-color: #490202 } /* Generic.Deleted */
201
+ .codehilite .ge { color: #c9d1d9; font-style: italic } /* Generic.Emph */
202
+ .codehilite .gr { color: #ffa198 } /* Generic.Error */
203
+ .codehilite .gh { color: #79c0ff; font-weight: bold } /* Generic.Heading */
204
+ .codehilite .gi { color: #56d364; background-color: #0f5323 } /* Generic.Inserted */
205
+ .codehilite .go { color: #8b949e } /* Generic.Output */
206
+ .codehilite .gp { color: #8b949e } /* Generic.Prompt */
207
+ .codehilite .gs { color: #c9d1d9; font-weight: bold } /* Generic.Strong */
208
+ .codehilite .gu { color: #79c0ff } /* Generic.Subheading */
209
+ .codehilite .gt { color: #ff7b72 } /* Generic.Traceback */
210
+ .codehilite .g-Underline { color: #c9d1d9; text-decoration: underline } /* Generic.Underline */
211
+ .codehilite .kc { color: #79c0ff } /* Keyword.Constant */
212
+ .codehilite .kd { color: #ff7b72 } /* Keyword.Declaration */
213
+ .codehilite .kn { color: #ff7b72 } /* Keyword.Namespace */
214
+ .codehilite .kp { color: #79c0ff } /* Keyword.Pseudo */
215
+ .codehilite .kr { color: #ff7b72 } /* Keyword.Reserved */
216
+ .codehilite .kt { color: #ff7b72 } /* Keyword.Type */
217
+ .codehilite .ld { color: #79c0ff } /* Literal.Date */
218
+ .codehilite .m { color: #a5d6ff } /* Literal.Number */
219
+ .codehilite .s { color: #a5d6ff } /* Literal.String */
220
+ .codehilite .na { color: #c9d1d9 } /* Name.Attribute */
221
+ .codehilite .nb { color: #c9d1d9 } /* Name.Builtin */
222
+ .codehilite .nc { color: #f0883e; font-weight: bold } /* Name.Class */
223
+ .codehilite .no { color: #79c0ff; font-weight: bold } /* Name.Constant */
224
+ .codehilite .nd { color: #d2a8ff; font-weight: bold } /* Name.Decorator */
225
+ .codehilite .ni { color: #ffa657 } /* Name.Entity */
226
+ .codehilite .ne { color: #f0883e; font-weight: bold } /* Name.Exception */
227
+ .codehilite .nf { color: #d2a8ff; font-weight: bold } /* Name.Function */
228
+ .codehilite .nl { color: #79c0ff; font-weight: bold } /* Name.Label */
229
+ .codehilite .nn { color: #ff7b72 } /* Name.Namespace */
230
+ .codehilite .nx { color: #c9d1d9 } /* Name.Other */
231
+ .codehilite .py { color: #79c0ff } /* Name.Property */
232
+ .codehilite .nt { color: #7ee787 } /* Name.Tag */
233
+ .codehilite .nv { color: #79c0ff } /* Name.Variable */
234
+ .codehilite .ow { color: #ff7b72; font-weight: bold } /* Operator.Word */
235
+ .codehilite .pm { color: #c9d1d9 } /* Punctuation.Marker */
236
+ .codehilite .w { color: #6e7681 } /* Text.Whitespace */
237
+ .codehilite .mb { color: #a5d6ff } /* Literal.Number.Bin */
238
+ .codehilite .mf { color: #a5d6ff } /* Literal.Number.Float */
239
+ .codehilite .mh { color: #a5d6ff } /* Literal.Number.Hex */
240
+ .codehilite .mi { color: #a5d6ff } /* Literal.Number.Integer */
241
+ .codehilite .mo { color: #a5d6ff } /* Literal.Number.Oct */
242
+ .codehilite .sa { color: #79c0ff } /* Literal.String.Affix */
243
+ .codehilite .sb { color: #a5d6ff } /* Literal.String.Backtick */
244
+ .codehilite .sc { color: #a5d6ff } /* Literal.String.Char */
245
+ .codehilite .dl { color: #79c0ff } /* Literal.String.Delimiter */
246
+ .codehilite .sd { color: #a5d6ff } /* Literal.String.Doc */
247
+ .codehilite .s2 { color: #a5d6ff } /* Literal.String.Double */
248
+ .codehilite .se { color: #79c0ff } /* Literal.String.Escape */
249
+ .codehilite .sh { color: #79c0ff } /* Literal.String.Heredoc */
250
+ .codehilite .si { color: #a5d6ff } /* Literal.String.Interpol */
251
+ .codehilite .sx { color: #a5d6ff } /* Literal.String.Other */
252
+ .codehilite .sr { color: #79c0ff } /* Literal.String.Regex */
253
+ .codehilite .s1 { color: #a5d6ff } /* Literal.String.Single */
254
+ .codehilite .ss { color: #a5d6ff } /* Literal.String.Symbol */
255
+ .codehilite .bp { color: #c9d1d9 } /* Name.Builtin.Pseudo */
256
+ .codehilite .fm { color: #d2a8ff; font-weight: bold } /* Name.Function.Magic */
257
+ .codehilite .vc { color: #79c0ff } /* Name.Variable.Class */
258
+ .codehilite .vg { color: #79c0ff } /* Name.Variable.Global */
259
+ .codehilite .vi { color: #79c0ff } /* Name.Variable.Instance */
260
+ .codehilite .vm { color: #79c0ff } /* Name.Variable.Magic */
261
+ .codehilite .il { color: #a5d6ff } /* Literal.Number.Integer.Long */
262
+
263
+ .dark .codehilite .hll { background-color: #2C3B41 }
264
+ .dark .codehilite .c { color: #79d618; font-style: italic } /* Comment */
265
+ .dark .codehilite .err { color: #FF5370 } /* Error */
266
+ .dark .codehilite .esc { color: #89DDFF } /* Escape */
267
+ .dark .codehilite .g { color: #EEFFFF } /* Generic */
268
+ .dark .codehilite .k { color: #BB80B3 } /* Keyword */
269
+ .dark .codehilite .l { color: #C3E88D } /* Literal */
270
+ .dark .codehilite .n { color: #EEFFFF } /* Name */
271
+ .dark .codehilite .o { color: #89DDFF } /* Operator */
272
+ .dark .codehilite .p { color: #89DDFF } /* Punctuation */
273
+ .dark .codehilite .ch { color: #79d618; font-style: italic } /* Comment.Hashbang */
274
+ .dark .codehilite .cm { color: #79d618; font-style: italic } /* Comment.Multiline */
275
+ .dark .codehilite .cp { color: #79d618; font-style: italic } /* Comment.Preproc */
276
+ .dark .codehilite .cpf { color: #79d618; font-style: italic } /* Comment.PreprocFile */
277
+ .dark .codehilite .c1 { color: #79d618; font-style: italic } /* Comment.Single */
278
+ .dark .codehilite .cs { color: #79d618; font-style: italic } /* Comment.Special */
279
+ .dark .codehilite .gd { color: #FF5370 } /* Generic.Deleted */
280
+ .dark .codehilite .ge { color: #89DDFF } /* Generic.Emph */
281
+ .dark .codehilite .gr { color: #FF5370 } /* Generic.Error */
282
+ .dark .codehilite .gh { color: #C3E88D } /* Generic.Heading */
283
+ .dark .codehilite .gi { color: #C3E88D } /* Generic.Inserted */
284
+ .dark .codehilite .go { color: #79d618 } /* Generic.Output */
285
+ .dark .codehilite .gp { color: #FFCB6B } /* Generic.Prompt */
286
+ .dark .codehilite .gs { color: #FF5370 } /* Generic.Strong */
287
+ .dark .codehilite .gu { color: #89DDFF } /* Generic.Subheading */
288
+ .dark .codehilite .gt { color: #FF5370 } /* Generic.Traceback */
289
+ .dark .codehilite .kc { color: #89DDFF } /* Keyword.Constant */
290
+ .dark .codehilite .kd { color: #BB80B3 } /* Keyword.Declaration */
291
+ .dark .codehilite .kn { color: #89DDFF; font-style: italic } /* Keyword.Namespace */
292
+ .dark .codehilite .kp { color: #89DDFF } /* Keyword.Pseudo */
293
+ .dark .codehilite .kr { color: #BB80B3 } /* Keyword.Reserved */
294
+ .dark .codehilite .kt { color: #BB80B3 } /* Keyword.Type */
295
+ .dark .codehilite .ld { color: #C3E88D } /* Literal.Date */
296
+ .dark .codehilite .m { color: #F78C6C } /* Literal.Number */
297
+ .dark .codehilite .s { color: #C3E88D } /* Literal.String */
298
+ .dark .codehilite .na { color: #BB80B3 } /* Name.Attribute */
299
+ .dark .codehilite .nb { color: #82AAFF } /* Name.Builtin */
300
+ .dark .codehilite .nc { color: #FFCB6B } /* Name.Class */
301
+ .dark .codehilite .no { color: #EEFFFF } /* Name.Constant */
302
+ .dark .codehilite .nd { color: #82AAFF } /* Name.Decorator */
303
+ .dark .codehilite .ni { color: #89DDFF } /* Name.Entity */
304
+ .dark .codehilite .ne { color: #FFCB6B } /* Name.Exception */
305
+ .dark .codehilite .nf { color: #82AAFF } /* Name.Function */
306
+ .dark .codehilite .nl { color: #82AAFF } /* Name.Label */
307
+ .dark .codehilite .nn { color: #FFCB6B } /* Name.Namespace */
308
+ .dark .codehilite .nx { color: #EEFFFF } /* Name.Other */
309
+ .dark .codehilite .py { color: #FFCB6B } /* Name.Property */
310
+ .dark .codehilite .nt { color: #FF5370 } /* Name.Tag */
311
+ .dark .codehilite .nv { color: #89DDFF } /* Name.Variable */
312
+ .dark .codehilite .ow { color: #89DDFF; font-style: italic } /* Operator.Word */
313
+ .dark .codehilite .pm { color: #89DDFF } /* Punctuation.Marker */
314
+ .dark .codehilite .w { color: #EEFFFF } /* Text.Whitespace */
315
+ .dark .codehilite .mb { color: #F78C6C } /* Literal.Number.Bin */
316
+ .dark .codehilite .mf { color: #F78C6C } /* Literal.Number.Float */
317
+ .dark .codehilite .mh { color: #F78C6C } /* Literal.Number.Hex */
318
+ .dark .codehilite .mi { color: #F78C6C } /* Literal.Number.Integer */
319
+ .dark .codehilite .mo { color: #F78C6C } /* Literal.Number.Oct */
320
+ .dark .codehilite .sa { color: #BB80B3 } /* Literal.String.Affix */
321
+ .dark .codehilite .sb { color: #C3E88D } /* Literal.String.Backtick */
322
+ .dark .codehilite .sc { color: #C3E88D } /* Literal.String.Char */
323
+ .dark .codehilite .dl { color: #EEFFFF } /* Literal.String.Delimiter */
324
+ .dark .codehilite .sd { color: #79d618; font-style: italic } /* Literal.String.Doc */
325
+ .dark .codehilite .s2 { color: #C3E88D } /* Literal.String.Double */
326
+ .dark .codehilite .se { color: #EEFFFF } /* Literal.String.Escape */
327
+ .dark .codehilite .sh { color: #C3E88D } /* Literal.String.Heredoc */
328
+ .dark .codehilite .si { color: #89DDFF } /* Literal.String.Interpol */
329
+ .dark .codehilite .sx { color: #C3E88D } /* Literal.String.Other */
330
+ .dark .codehilite .sr { color: #89DDFF } /* Literal.String.Regex */
331
+ .dark .codehilite .s1 { color: #C3E88D } /* Literal.String.Single */
332
+ .dark .codehilite .ss { color: #89DDFF } /* Literal.String.Symbol */
333
+ .dark .codehilite .bp { color: #89DDFF } /* Name.Builtin.Pseudo */
334
+ .dark .codehilite .fm { color: #82AAFF } /* Name.Function.Magic */
335
+ .dark .codehilite .vc { color: #89DDFF } /* Name.Variable.Class */
336
+ .dark .codehilite .vg { color: #89DDFF } /* Name.Variable.Global */
337
+ .dark .codehilite .vi { color: #89DDFF } /* Name.Variable.Instance */
338
+ .dark .codehilite .vm { color: #82AAFF } /* Name.Variable.Magic */
339
+ .dark .codehilite .il { color: #F78C6C } /* Literal.Number.Integer.Long */
340
+
341
  """