Skip to content

Commit 378a25f

Browse files
committed
enhance: use font awesome copy icon and high-contrast setting for all themes
1 parent 75439de commit 378a25f

9 files changed

Lines changed: 22 additions & 7 deletions

File tree

_includes/scripts/lib/copy-to-clipboard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var snippets = document.querySelectorAll('pre');
33
[].forEach.call(snippets, function(snippet) {
44
if (snippet.closest('.snippet') !== null) {
5-
snippet.firstChild.insertAdjacentHTML('beforebegin', '<button class="btn" data-clipboard-snippet><img class="clippy" height="20" src="/assets/clippy.svg" alt="Copy to clipboard"></button>');
5+
snippet.firstChild.insertAdjacentHTML('beforebegin', '<button class="btn" data-clipboard-snippet><i class="far fa-copy"></i></button>');
66
}
77
});
88
var clipboardSnippets = new ClipboardJS('[data-clipboard-snippet]', {

_sass/additional/_copy-to-clipboard.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@
6161
transform: translateX(50%)
6262
}
6363

64-
.clippy {
64+
.fa-copy {
6565
margin-top: -3px;
6666
position: relative;
6767
top: 3px
6868
}
6969

70-
.btn[disabled] .clippy {
70+
.btn[disabled] .fa-copy {
7171
opacity: .3
7272
}
7373

@@ -84,7 +84,8 @@
8484
padding: 2px 6px;
8585
position: absolute;
8686
right: 4px;
87-
top: 4px
87+
top: 4px;
88+
color: $copy-button-color
8889
}
8990

9091
.snippet:hover .btn, .snippet .btn:focus {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// copy button color
2+
$copy-button-color: #000;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
@import "./tomorrow/night-blue";
22
@import "./tomorrow/highlight";
3+
4+
// copy button color
5+
$copy-button-color: #fff;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
@import "./tomorrow/night-bright";
22
@import "./tomorrow/highlight";
3+
4+
// copy button color
5+
$copy-button-color: #fff;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
@import "./tomorrow/night-eighties";
22
@import "./tomorrow/highlight";
3+
4+
// copy button color
5+
$copy-button-color: #fff;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
@import "./tomorrow/night";
22
@import "./tomorrow/highlight";
3+
4+
// copy button color
5+
$copy-button-color: #fff;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
@import "./tomorrow/default";
22
@import "./tomorrow/highlight";
3+
4+
// copy button color
5+
$copy-button-color: #000;

assets/clippy.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)