Files
gitea-pages/overrides/javascripts/color-toggle.js
Noah Pombas 90a5c560f6
Some checks failed
Build and Deploy Documentation / build-and-deploy (push) Failing after 3s
Added Custom JS and CSS
2025-12-04 16:16:24 +01:00

14 lines
397 B
JavaScript

const palettes = ["blue", "purple", "green"];
let current = 0;
function switchColor() {
current = (current + 1) % palettes.length;
const color = palettes[current];
document.documentElement.setAttribute("data-md-color-scheme", color);
}
window.addEventListener("DOMContentLoaded", () => {
const btn = document.getElementById("color-toggle-btn");
if (btn) btn.onclick = switchColor;
});