Skip to content

Commit

Permalink
feat: apply CSS changes on JS input & change color events scidsg#573
Browse files Browse the repository at this point in the history
For Roadmap Item scidsg#533
  • Loading branch information
rmlibre committed Sep 13, 2024
1 parent e397e8f commit ed8a92f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions hushline/static/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ document.addEventListener("DOMContentLoaded", function () {
});
});

// Update color in real-time as they're being browsed
document
.getElementById("brand-primary-color")
.addEventListener("input", function(event) {
const brandColor = `lch(from ${event.target.value} l c h)`;
document.documentElement.style.setProperty("--color-brand", brandColor);
document.body.offsetHeight; // force a reflow
});

// Update color once it's been finalized
document
.getElementById("brand-primary-color")
.addEventListener("change", function(event) {
const brandColor = `lch(from ${event.target.value} l c h)`;
document.documentElement.style.setProperty("--color-brand", brandColor);
document.body.offsetHeight; // force a reflow
});

var forwarding_enabled = document.querySelector(
"input[id='forwarding_enabled']",
).checked;
Expand Down

0 comments on commit ed8a92f

Please sign in to comment.