Skip to content

Commit

Permalink
copy hex code with Ctrl-click
Browse files Browse the repository at this point in the history
  • Loading branch information
crashdemons committed Feb 29, 2024
1 parent 7991075 commit 684ab7c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,14 @@ class NickFade {
document.getElementById('import').onclick = this.UI.importState.bind(this.UI);
this.UI.getColorBoxes().forEach(box=>{
box.onclick=function(e){
if (e.shiftKey || e.altKey || e.ctrlKey){
if (e.shiftKey || e.altKey){
e.preventDefault();
NickFade.UI.promptHexColorForInput(this,e);
}
if(e.ctrlKey){
e.preventDefault();
navigator.clipboard.writeText((this.value??"#").substring(1));
alert("Copied Hex Code!");
}
}
});
Expand Down

0 comments on commit 684ab7c

Please sign in to comment.