dodati dinamicku boju, slike, te lijepsi kod

This commit is contained in:
marin 2025-03-12 20:23:53 +01:00
parent d2872a8fbf
commit 1c216985f1
8 changed files with 122 additions and 106 deletions

19
html/main.js Normal file
View file

@ -0,0 +1,19 @@
function updateBackgroundColor() {
const now = new Date();
const hours = now.getHours();
let color = "#FFFFFF";
if (hours >= 6 && hours < 12) {
color = "#FFFAE3";
} else if (hours >= 12 && hours < 18) {
color = "#C7E9FB";
} else if (hours >= 18 && hours < 21) {
color = "#FFB87A";
} else {
color = "#1E1E30";
}
document.body.style.backgroundColor = color;
}
window.onload = () => {
updateBackgroundColor();
setInterval(updateBackgroundColor, 60000);
};