MediaWiki:Vector.js: Difference between revisions
No edit summary |
No edit summary |
||
Line 16: | Line 16: | ||
}) | }) | ||
// | // Background color randomizer | ||
function getRandomBrightColor() { | function getRandomBrightColor() { | ||
const min = 200; // Minimum value for bright colors | const min = 200; // Minimum value for bright colors | ||
Line 24: | Line 24: | ||
return `rgb(${r},${g},${b})`; | return `rgb(${r},${g},${b})`; | ||
} | } | ||
// Set the initial random background color | // Set the initial random background color | ||
function setInitialBackgroundColor() { | function setInitialBackgroundColor() { | ||
const randomColor = getRandomBrightColor(); | const randomColor = getRandomBrightColor(); | ||
document. | document.documentElement.style.setProperty('--background-color-base', randomColor); | ||
} | } | ||
// Gradually change the background color | // Gradually change the background color | ||
function changeBackgroundGradually() { | function changeBackgroundGradually() { | ||
setInterval(() => { | setInterval(() => { | ||
const randomColor = getRandomBrightColor(); | const randomColor = getRandomBrightColor(); | ||
document. | document.documentElement.style.transition = "background-color 2s linear"; // Smooth transition | ||
document. | document.documentElement.style.setProperty('--background-color-base', randomColor); | ||
}, 5000); // Change every 5 seconds | }, 5000); // Change every 5 seconds | ||
} | } | ||
// Initialize the process | // Initialize the process | ||
setInitialBackgroundColor(); | setInitialBackgroundColor(); | ||
changeBackgroundGradually(); | changeBackgroundGradually(); |