-
Notifications
You must be signed in to change notification settings - Fork 236
Expand file tree
/
Copy pathargparse-highlight.css
More file actions
437 lines (380 loc) · 9.69 KB
/
argparse-highlight.css
File metadata and controls
437 lines (380 loc) · 9.69 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
/*
* Argparse/CLI Highlighting Styles
*
* Styles for CLI inline roles and argparse help output highlighting.
* Uses "One Dark" inspired color palette (Python 3.14 argparse style).
*
* Color Palette:
* Background: #282C34
* Default text: #CCCED4
* Usage label: #61AFEF (blue, bold)
* Program name: #C678DD (purple, bold)
* Subcommands: #98C379 (green)
* Options: #56B6C2 (teal)
* Metavars: #E5C07B (yellow, italic)
* Choices: #98C379 (green)
* Headings: #E5E5E5 (bright, bold)
* Punctuation: #CCCED4
*/
/* ==========================================================================
Inline Role Styles
========================================================================== */
/*
* Shared monospace font and code font-size for all CLI inline roles
*/
.cli-option,
.cli-metavar,
.cli-command,
.cli-default,
.cli-choice {
font-family: var(--font-stack--monospace);
font-size: var(--code-font-size);
}
/*
* CLI Options
*
* Long options (--verbose) and short options (-h) both use teal color.
*/
.cli-option-long,
.cli-option-short {
color: #56b6c2;
}
/*
* CLI Metavars
*
* Placeholder values like FILE, PATH, DIRECTORY.
* Yellow/amber to indicate "replace me" - distinct from flags (teal).
*/
.cli-metavar {
color: #e5c07b;
font-style: italic;
}
/*
* CLI Commands and Choices
*
* Both use green to indicate valid enumerated values.
* Commands: subcommand names like sync, add, list
* Choices: enumeration values like json, yaml, table
*/
.cli-command,
.cli-choice {
color: #98c379;
}
.cli-command {
font-weight: bold;
}
/*
* CLI Default Values
*
* Default values shown in help text like None, "auto".
* Subtle styling to not distract from options.
*/
.cli-default {
color: #ccced4;
font-style: italic;
}
/* ==========================================================================
Argparse Code Block Highlighting
========================================================================== */
/*
* These styles apply within Pygments-highlighted code blocks using the
* argparse, argparse-usage, or argparse-help lexers.
*/
/* Usage heading "usage:" - bold blue */
.highlight-argparse .gh,
.highlight-argparse-usage .gh,
.highlight-argparse-help .gh {
color: #61afef;
font-weight: bold;
}
/* Section headers like "positional arguments:", "options:" - neutral bright */
.highlight-argparse .gs,
.highlight-argparse-help .gs {
color: #e5e5e5;
font-weight: bold;
}
/* Long options --foo - teal */
.highlight-argparse .nt,
.highlight-argparse-usage .nt,
.highlight-argparse-help .nt {
color: #56b6c2;
font-weight: normal;
}
/* Short options -h - teal (same as long) */
.highlight-argparse .na,
.highlight-argparse-usage .na,
.highlight-argparse-help .na {
color: #56b6c2;
font-weight: normal;
}
/* Metavar placeholders FILE, PATH - yellow/amber italic */
.highlight-argparse .nv,
.highlight-argparse-usage .nv,
.highlight-argparse-help .nv {
color: #e5c07b;
font-style: italic;
}
/* Command/program names - purple bold */
.highlight-argparse .nl,
.highlight-argparse-usage .nl,
.highlight-argparse-help .nl {
color: #c678dd;
font-weight: bold;
}
/* Subcommands - bold green */
.highlight-argparse .nf,
.highlight-argparse-usage .nf,
.highlight-argparse-help .nf {
color: #98c379;
font-weight: bold;
}
/* Choice values - green */
.highlight-argparse .no,
.highlight-argparse-usage .no,
.highlight-argparse-help .no,
.highlight-argparse .nc,
.highlight-argparse-usage .nc,
.highlight-argparse-help .nc {
color: #98c379;
}
/* Punctuation [], {}, () - neutral gray */
.highlight-argparse .p,
.highlight-argparse-usage .p,
.highlight-argparse-help .p {
color: #ccced4;
}
/* Operators like | - neutral gray */
.highlight-argparse .o,
.highlight-argparse-usage .o,
.highlight-argparse-help .o {
color: #ccced4;
font-weight: normal;
}
/* ==========================================================================
Argparse Directive Highlighting (.. argparse:: output)
========================================================================== */
/*
* These styles apply to the argparse directive output which uses custom
* nodes rendered by sphinx_argparse_neo. The directive adds highlight spans
* directly to the HTML output.
*/
/*
* Usage Block (.argparse-usage)
*
* The usage block now has both .argparse-usage and .highlight-argparse-usage
* classes. The .highlight-argparse-usage selectors above already handle the
* token highlighting. These selectors provide fallback and ensure consistent
* styling.
*/
/* Usage block container - match Pygments monokai background and code block styling */
pre.argparse-usage {
background: var(--argparse-code-background);
font-size: var(--code-font-size);
padding: 0.625rem 0.875rem;
line-height: 1.5;
border-radius: 0.2rem;
scrollbar-color: var(--color-foreground-border) transparent;
scrollbar-width: thin;
}
.argparse-usage .gh {
color: #61afef;
font-weight: bold;
}
.argparse-usage .nt {
color: #56b6c2;
font-weight: normal;
}
.argparse-usage .na {
color: #56b6c2;
font-weight: normal;
}
.argparse-usage .nv {
color: #e5c07b;
font-style: italic;
}
.argparse-usage .nl {
color: #c678dd;
font-weight: bold;
}
.argparse-usage .nf {
color: #98c379;
font-weight: bold;
}
.argparse-usage .no,
.argparse-usage .nc {
color: #98c379;
}
.argparse-usage .o {
color: #ccced4;
font-weight: normal;
}
.argparse-usage .p {
color: #ccced4;
}
/*
* Argument Name (<dt class="argparse-argument-name">)
*
* The argument names in the dl/dt structure are highlighted with
* semantic spans for options and metavars.
*/
.argparse-argument-name .nt {
color: #56b6c2;
font-weight: normal;
}
.argparse-argument-name .na {
color: #56b6c2;
font-weight: normal;
}
.argparse-argument-name .nv {
color: #e5c07b;
font-style: italic;
}
.argparse-argument-name .nl {
color: #c678dd;
font-weight: bold;
}
/* ==========================================================================
Argument Wrapper and Linking Styles
========================================================================== */
/*
* Argparse-specific code background (monokai #272822)
* Uses a custom variable to avoid affecting Furo's --color-inline-code-background.
*/
:root {
--argparse-code-background: #272822;
}
/*
* Background styling for argument names - subtle background like code.literal
* This provides visual weight and hierarchy for argument definitions.
*/
.argparse-argument-name {
background: var(--argparse-code-background);
border-radius: 0.2rem;
padding: 0.485rem 0.875rem;
font-family: var(--font-stack--monospace);
font-size: var(--code-font-size);
width: fit-content;
position: relative;
}
/*
* Wrapper for linking - enables scroll-margin for fixed header navigation
* and :target pseudo-class for highlighting when linked.
*/
.argparse-argument-wrapper {
scroll-margin-top: 2.5rem;
}
/*
* Headerlink anchor (¶) - hidden until hover
* Positioned outside the dt element to the right.
* Follows Sphinx documentation convention for linkable headings.
*/
.argparse-argument-name .headerlink {
visibility: hidden;
position: absolute;
right: -1.5rem;
top: 50%;
transform: translateY(-50%);
color: var(--color-foreground-secondary);
text-decoration: none;
}
/*
* Show headerlink on hover or when targeted via URL fragment
*/
.argparse-argument-wrapper:hover .headerlink,
.argparse-argument-wrapper:target .headerlink {
visibility: visible;
}
.argparse-argument-name .headerlink:hover:not(:visited) {
color: var(--color-foreground-primary);
}
/*
* Light mode headerlink color overrides
* Needed because code block has dark background regardless of theme
*/
body[data-theme="light"] .argparse-argument-name .headerlink {
color: #9ca0a5;
&:hover:not(:visited) {
color: #cfd0d0;
}
}
@media (prefers-color-scheme: light) {
body:not([data-theme="dark"]) .argparse-argument-name .headerlink {
color: #9ca0a5;
&:hover:not(:visited) {
color: #cfd0d0;
}
}
}
/*
* Highlight when targeted via URL fragment
* Uses Furo's highlight-on-target color for consistency.
*/
.argparse-argument-wrapper:target .argparse-argument-name {
background-color: var(--color-highlight-on-target);
}
/*
* Argument metadata definition list
*
* Renders metadata (Default, Type, Choices, Required) as a horizontal
* flexbox of key-value pairs and standalone tags.
*/
.argparse-argument-meta {
margin: 0.5rem 0 0 0;
padding: 0;
display: flex;
flex-wrap: wrap;
gap: 0.5rem 1rem;
align-items: center;
}
.argparse-meta-item {
display: flex;
align-items: center;
gap: 0.25rem;
}
.argparse-meta-key {
color: var(--color-foreground-secondary, #6c757d);
font-size: var(--code-font-size);
}
.argparse-meta-key::after {
content: ":";
}
.argparse-meta-value .nv {
background: var(--argparse-code-background);
border-radius: 0.2rem;
padding: 0.1rem 0.3rem;
font-family: var(--font-stack--monospace);
font-size: var(--code-font-size);
color: #e5c07b;
}
/*
* Meta tag (e.g., "Required") - follows Furo's guilabel pattern
* Uses semi-transparent amber background with border for visibility
* without the harshness of solid fills. Amber conveys "needs attention".
*/
.argparse-meta-tag {
background-color: #fef3c780;
border: 1px solid #fcd34d80;
color: var(--color-foreground-primary);
font-size: var(--code-font-size);
padding: 0.1rem 0.4rem;
border-radius: 0.2rem;
font-weight: 500;
}
/* Dark mode: darker amber with adjusted border */
body[data-theme="dark"] .argparse-meta-tag {
background-color: #78350f60;
border-color: #b4530980;
}
@media (prefers-color-scheme: dark) {
body:not([data-theme="light"]) .argparse-meta-tag {
background-color: #78350f60;
border-color: #b4530980;
}
}
/*
* Help text description
* Adds spacing above for visual separation from argument name.
*/
.argparse-argument-help {
padding-block-start: 0.5rem;
}