Skip to content

Commit b90e534

Browse files
committed
feat: Style button using themeColor config setting
1 parent e968ab9 commit b90e534

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
button.appendChild(document.createTextNode("Click to copy"));
1111
button.classList.add("docsify-copy-code-button");
1212

13+
if (vm.config.themeColor) {
14+
button.style.background = vm.config.themeColor;
15+
}
16+
1317
button.addEventListener("click", function(event) {
1418
var range = document.createRange();
1519
var codeBlock = element.querySelector("code");

styles.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.docsify-copy-code-button {
2-
background: rgba(243, 112, 70, 1);
2+
background: #ccc;
33
color: #fff;
44
position: absolute;
55
top: 0;
@@ -20,13 +20,14 @@
2020
right: 100%;
2121
top: 0;
2222
background: #ccc;
23-
color: #222;
23+
color: #fff;
2424
padding: 5px;
2525
margin: 5px 10px 0;
2626
font-size: 11px;
2727
z-index: 0;
2828
transition: all 0.25s ease;
2929
transform: translateX(120%) scale(0);
30+
border-radius: 3px;
3031
}
3132

3233
.docsify-copy-code-button.success::after {

0 commit comments

Comments
 (0)