Skip to content

Commit 358b3e8

Browse files
committed
style(css): Consolidate duplicate selectors and use CSS variable
- Extract shared font-family into combined .cli-* selector rule - Merge .cli-option-long and .cli-option-short (identical color) - Combine hover and :target headerlink visibility rules - Replace hardcoded #272822 with var(--argparse-code-background)
1 parent 24a86d3 commit 358b3e8

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

docs/_static/css/argparse-highlight.css

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,22 @@
2222
========================================================================== */
2323

2424
/*
25-
* CLI Options
26-
*
27-
* Long options (--verbose) and short options (-h) both use teal color.
25+
* Shared monospace font for all CLI inline roles
2826
*/
29-
.cli-option {
27+
.cli-option,
28+
.cli-metavar,
29+
.cli-command,
30+
.cli-default,
31+
.cli-choice {
3032
font-family: var(--font-stack--monospace);
3133
}
3234

33-
.cli-option-long {
34-
color: #56B6C2;
35-
}
36-
35+
/*
36+
* CLI Options
37+
*
38+
* Long options (--verbose) and short options (-h) both use teal color.
39+
*/
40+
.cli-option-long,
3741
.cli-option-short {
3842
color: #56B6C2;
3943
}
@@ -45,7 +49,6 @@
4549
* Yellow/amber to indicate "replace me" - distinct from flags (teal).
4650
*/
4751
.cli-metavar {
48-
font-family: var(--font-stack--monospace);
4952
color: #E5C07B;
5053
font-style: italic;
5154
}
@@ -57,7 +60,6 @@
5760
* Green (same as choices) - they're enumerated command options.
5861
*/
5962
.cli-command {
60-
font-family: var(--font-stack--monospace);
6163
color: #98C379;
6264
font-weight: bold;
6365
}
@@ -69,7 +71,6 @@
6971
* Subtle styling to not distract from options.
7072
*/
7173
.cli-default {
72-
font-family: var(--font-stack--monospace);
7374
color: #CCCED4;
7475
font-style: italic;
7576
}
@@ -81,7 +82,6 @@
8182
* Green color to show they are valid literal values.
8283
*/
8384
.cli-choice {
84-
font-family: var(--font-stack--monospace);
8585
color: #98C379;
8686
}
8787

@@ -195,7 +195,7 @@
195195

196196
/* Usage block container - match Pygments monokai background and code block styling */
197197
pre.argparse-usage {
198-
background: #272822; /* Monokai - same as .highlight */
198+
background: var(--argparse-code-background);
199199
padding: .625rem .875rem;
200200
line-height: 1.5;
201201
border-radius: .2rem;
@@ -321,7 +321,11 @@ body:not([data-theme="dark"]) .argparse-argument-name .headerlink {
321321
color: #9ca0a5;
322322
}
323323

324-
.argparse-argument-name:hover .headerlink {
324+
/*
325+
* Show headerlink on hover or when targeted via URL fragment
326+
*/
327+
.argparse-argument-name:hover .headerlink,
328+
.argparse-argument-wrapper:target .argparse-argument-name .headerlink {
325329
visibility: visible;
326330
}
327331

@@ -341,10 +345,6 @@ body:not([data-theme="dark"]) .argparse-argument-name .headerlink:hover:not(:vis
341345
background-color: var(--color-highlight-on-target);
342346
}
343347

344-
.argparse-argument-wrapper:target .argparse-argument-name .headerlink {
345-
visibility: visible;
346-
}
347-
348348
/*
349349
* Default value styling in metadata
350350
* Styled like inline code with monokai background.

0 commit comments

Comments
 (0)