Skip to content

Commit

Permalink
Make sphinx-copybutton look better
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg committed Mar 24, 2022
1 parent 38227d4 commit d396718
Showing 1 changed file with 45 additions and 14 deletions.
59 changes: 45 additions & 14 deletions src/furo/assets/styles/extensions/_copybutton.sass
Original file line number Diff line number Diff line change
@@ -1,14 +1,45 @@
.highlight button.copybtn
color: var(--color-foreground-secondary)
background-color: var(--color-background-secondary)
border: 1px solid var(--color-background-border)

&.success
border-color: #22863a
&:hover
color: var(--color-foreground-primary)
background-color: var(--color-background-primary)

&::after
color: var(--color-foreground-secondary)
background: var(--color-background-primary)
.highlight
&:hover button.copybtn
color: var(--color-code-foreground)

button.copybtn
// Make it visible
opacity: 1

// Align things correctly
align-items: center

height: 1.25em
width: 1.25em

top: 0.625rem // $code-spacing-vertical
right: 0.5rem

// Make it look better
color: var(--color-foreground-border)
background-color: var(--color-code-background)
border: none

// Change to cursor to make it obvious that you can click on it
cursor: pointer

// Transition smoothly, for aesthetics
transition: color 300ms, opacity 300ms

&:hover
color: var(--color-brand-content)
background-color: var(--color-code-background)

&::after
display: none
color: var(--color-code-foreground)
background-color: transparent

&.success
transition: color 0ms
color: #22863a
&::after
display: block

svg
padding: 0

0 comments on commit d396718

Please sign in to comment.