import { hijackClickEvent } from "./main.js";

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();
});

document.querySelectorAll("ul#projects li.project-item").forEach(projectItem => {
    const link = projectItem.querySelector('a');
    hijackClickEvent(projectItem, link);
});
