17 lines
606 B
JavaScript
17 lines
606 B
JavaScript
const hexPrimary = document.getElementById("hex-primary");
|
|
const hexSecondary = document.getElementById("hex-secondary");
|
|
const hexTertiary = document.getElementById("hex-tertiary");
|
|
|
|
function updateHexColours() {
|
|
const style = getComputedStyle(document.body);
|
|
hexPrimary.textContent = style.getPropertyValue('--primary');
|
|
hexSecondary.textContent = style.getPropertyValue('--secondary');
|
|
hexTertiary.textContent = style.getPropertyValue('--tertiary');
|
|
}
|
|
|
|
updateHexColours();
|
|
|
|
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
updateHexColours();
|
|
});
|