From a4ac07de22e8292f11c63a95878e9ec2dc8eb08e Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Tue, 29 Sep 2020 16:47:58 +0200 Subject: [PATCH] Fix Javascript bug in colour palette --- templates/palette.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/palette.html b/templates/palette.html index eb7ccc1..7209622 100644 --- a/templates/palette.html +++ b/templates/palette.html @@ -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:
${hsla}`, hsla, event.clientX, event.clientY);