feat(color-change): add input event listener for color updates and toggle visibility with Ctrl+C

This commit is contained in:
taroj1205 2024-11-11 22:52:12 +13:00
parent 0d36566ae0
commit 601ed154dc

View file

@ -62,6 +62,17 @@
const color = (e.target as HTMLInputElement).value;
document.documentElement.style.setProperty("--primary", color);
});
colorInput?.addEventListener("input", (e) => {
const color = (e.target as HTMLInputElement).value;
document.documentElement.style.setProperty("--primary", color);
});
document.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.key === "c") {
colorInput?.classList.toggle("hidden");
}
});
</script>
<style>