Skip to content

Commit

Permalink
Add seed to picsum
Browse files Browse the repository at this point in the history
  • Loading branch information
cdmoro committed Oct 5, 2024
1 parent 1689f96 commit 42dd315
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/modules/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ export function setTheme({ isVariantChange = false } = {}) {
}

export function setDynamicBackgroundPicture() {
const now = new Date();
const seed = `${now.getFullYear()}${
now.getMonth() + 1
}${now.getDay()}${now.getHours()}${now.getMinutes()}`;
let innerHeight = window.innerHeight;
let innerWidth = window.innerWidth;

Expand All @@ -136,9 +140,7 @@ export function setDynamicBackgroundPicture() {
innerWidth = 5000;
}

document.body.style.backgroundImage = `url(https://picsum.photos/${innerWidth}/${innerHeight}?blur=1&random=${Math.floor(
Math.random() * 90
)})`;
document.body.style.backgroundImage = `url(https://picsum.photos/seed/${seed}/${innerWidth}/${innerHeight}?blur=1)`;
}

export function removeBackgroundImage() {
Expand Down

0 comments on commit 42dd315

Please sign in to comment.