All checks were successful
Build and Deploy Documentation / build-and-deploy (push) Successful in 4s
15 lines
405 B
JavaScript
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);
|