Skip to content

Commit 281e103

Browse files
authored
ENH: Adapt target viewcode to tango highlighting style (#635)
1 parent 2e88b0f commit 281e103

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"sphinx.ext.autodoc",
3939
"sphinx.ext.autosummary",
4040
"sphinxext.rediraffe",
41+
"sphinx.ext.viewcode",
4142
]
4243

4344
# -- Internationalization ------------------------------------------------

src/pydata_sphinx_theme/assets/styles/base/_color.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ html[data-theme="light"] {
8989
--pst-color-preformatted-background: var(--pst-color-background-up);
9090
--pst-color-preformatted-shadow: var(--pst-color-shadow);
9191

92+
// targeted viewcode
93+
--pst-color-viewcode-target-border: rgb(170, 204, 153);
94+
--pst-color-viewcode-target-background: rgb(244, 222, 191);
95+
9296
/*****************************************************************************
9397
* layout
9498
*/
@@ -232,6 +236,10 @@ html[data-theme="dark"] {
232236
--pst-color-preformatted-background: var(--pst-color-background-up);
233237
--pst-color-preformatted-shadow: var(--pst-color-shadow);
234238

239+
// targeted viewcode
240+
--pst-color-viewcode-target-border: rgb(170, 204, 153);
241+
--pst-color-viewcode-target-background: rgb(35, 55, 83);
242+
235243
/*****************************************************************************
236244
* layout
237245
*/

src/pydata_sphinx_theme/assets/styles/content/_api.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ span.highlighted {
9999
}
100100

101101
.viewcode-block:target {
102-
background-color: #f4debf;
103-
border-top: 1px solid #ac9;
104-
border-bottom: 1px solid #ac9;
102+
background-color: var(--pst-color-viewcode-target-background);
103+
border-top: 1px solid var(--pst-color-viewcode-target-border);
104+
border-bottom: 1px solid var(--pst-color-viewcode-target-border);
105105
}

0 commit comments

Comments
 (0)