Files
gitea-pages/overrides/javascripts/color-toggle.js
Noah Pombas 2c6f7d5987
All checks were successful
Build and Deploy Documentation / build-and-deploy (push) Successful in 4s
Circle emoji added and changed color
2025-12-04 16:06:01 +01:00

15 lines
405 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);
}
// Botão no topo do site
const btn = document.createElement("button");
btn.textContent = "Switch Color";
btn.onclick = switchColor;
document.body.prepend(btn);