Skip to content

Commit

Permalink
Update color_compare.html
Browse files Browse the repository at this point in the history
  • Loading branch information
RagingRoosevelt authored Mar 29, 2024
1 parent 9e1ac46 commit 159d82b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/color_compare.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
function init_page() {
color_pickers = document.querySelectorAll("input[type='color']")
text_inputs = document.querySelectorAll("input[type='text']")
display_elements = document.querySelectorAll("article div")

for (let k=0; k < color_pickers.length; k+=1) {
color_pickers[k].addEventListener("input", update => {
Expand All @@ -66,6 +67,15 @@
color_pickers[k].value = update.target.value;
change_color(k+1, update.target.value)
})
display_elements[k].addEventListener("click", event => {
const target_div = event.currentTarget
const value_holding_elem = target_div.getElementsByTagName("span")[0]
const color_string = value_holding_elem.textContent

if (color_string.length > 0) {
navigator.clipboard.writeText(color_string);
}
})
}
}

Expand Down

0 comments on commit 159d82b

Please sign in to comment.