Add a copy button to code samples (#231) · python/python-docs-theme@d528dbc · GitHub
Skip to content

Commit d528dbc

Browse files
tomasr8hugovk
andauthored
Add a copy button to code samples (#231)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent 6ac5c06 commit d528dbc

3 files changed

Lines changed: 76 additions & 65 deletions

File tree

python_docs_theme/static/copybutton.js

Lines changed: 49 additions & 57 deletions

python_docs_theme/static/pydoctheme.css

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -442,17 +442,23 @@ div.genindex-jumpbox a {
442442
top: 0;
443443
right: 0;
444444
font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
445-
padding-left: 0.2em;
446-
padding-right: 0.2em;
445+
font-size: 80%;
446+
padding-left: .5em;
447+
padding-right: .5em;
448+
height: 100%;
449+
max-height: min(100%, 2.4em);
447450
border-radius: 0 3px 0 0;
448-
color: #ac9; /* follows div.body pre */
449-
border-color: #ac9; /* follows div.body pre */
450-
border-style: solid; /* follows div.body pre */
451-
border-width: 1px; /* follows div.body pre */
451+
color: #000;
452+
background-color: #fff;
453+
border: 1px solid #ac9; /* follows div.body pre */
454+
}
455+
456+
.copybutton:hover {
457+
background-color: #eee;
452458
}
453459

454-
.copybutton[data-hidden='true'] {
455-
text-decoration: line-through;
460+
.copybutton:active {
461+
background-color: #ddd;
456462
}
457463

458464
@media (max-width: 1023px) {

python_docs_theme/static/pydoctheme_dark.css

Lines changed: 13 additions & 0 deletions

0 commit comments

Comments
 (0)