Fix Javascript bug in colour palette
This commit is contained in:
parent
3b21844d74
commit
a4ac07de22
1 changed files with 1 additions and 1 deletions
|
@ -205,7 +205,7 @@
|
||||||
window.addEventListener("load", function() {
|
window.addEventListener("load", function() {
|
||||||
document.querySelectorAll('div.colors span').forEach(function(span) {
|
document.querySelectorAll('div.colors span').forEach(function(span) {
|
||||||
span.addEventListener('click', function(event) {
|
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)`
|
let hsla = `hsla(${prop("--hue")}, ${prop("--saturation")}, ${prop("--lightness")}, 1)`
|
||||||
navigator.clipboard.writeText(hsla).then(function() {
|
navigator.clipboard.writeText(hsla).then(function() {
|
||||||
show_message(`Copied to Clipboard:<br>${hsla}`, hsla, event.clientX, event.clientY);
|
show_message(`Copied to Clipboard:<br>${hsla}`, hsla, event.clientX, event.clientY);
|
||||||
|
|
Loading…
Reference in a new issue