| 1 |
/** |
| 2 |
* Sphinx Copybutton |
| 3 |
* ref: https://sphinx-copybutton.readthedocs.io/ |
| 4 |
*/ |
| 5 |
|
| 6 |
div.highlight button.copybtn { |
| 7 |
// Nicer spacing |
| 8 |
display: flex; |
| 9 |
align-items: center; |
| 10 |
justify-content: center; |
| 11 |
|
| 12 |
// Don't over-ride the success color |
| 13 |
&:not(.success) { |
| 14 |
color: var(--pst-color-muted); |
| 15 |
} |
| 16 |
|
| 17 |
border: none; |
| 18 |
background-color: var(--pst-color-surface); |
| 19 |
|
| 20 |
&:hover { |
| 21 |
&:not(.success) { |
| 22 |
color: var(--pst-color-text); |
| 23 |
background-color: var(--pst-color-shadow); |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
// Tooltip styling |
| 28 |
&.o-tooltip--left::after { |
| 29 |
color: var(--pst-color-text); |
| 30 |
background-color: var(--pst-color-surface); |
| 31 |
} |
| 32 |
|
| 33 |
&:focus { |
| 34 |
// For keyboard users, make the copy button visible when focussed. |
| 35 |
opacity: 1; |
| 36 |
} |
| 37 |
|
| 38 |
&:focus-visible { |
| 39 |
outline: $focus-ring-outline; |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
div.highlight:has(button.copybtn) { |
| 44 |
// Make sure the code block has enough height for the copy button. |
| 45 |
// Sphinx-copybutton sets 0.3em top offset plus 1.7em height: |
| 46 |
// https://github.com/executablebooks/sphinx-copybutton/blob/master/sphinx_copybutton/_static/copybutton.css |
| 47 |
min-height: 2em; |
| 48 |
} |