Fix Javascript bug in colour palette

This commit is contained in:
Talia 2020-09-29 16:47:58 +02:00
parent 3b21844d74
commit a4ac07de22
1 changed files with 1 additions and 1 deletions

View File

@ -205,7 +205,7 @@
window.addEventListener("load", function() {
document.querySelectorAll('div.colors span').forEach(function(span) {
span.addEventListener('click', function(event) {
let prop = name => getComputedStyle(event.target).getPropertyValue(name)
let prop = name => getComputedStyle(event.target).getPropertyValue(name).replace(/^ *| *$/g, "")
let hsla = `hsla(${prop("--hue")}, ${prop("--saturation")}, ${prop("--lightness")}, 1)`
navigator.clipboard.writeText(hsla).then(function() {
show_message(`Copied to Clipboard:<br>${hsla}`, hsla, event.clientX, event.clientY);