From 06cf76d724b8d2f145b14f05a59aac3bf453052b Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 30 Sep 2025 09:07:20 -0700 Subject: [PATCH] Fix: restore bg image to body again (#5828) --- src/pages/index.jsx | 68 ++++++++++++++++++++++++------------------ src/styles/globals.css | 12 -------- 2 files changed, 39 insertions(+), 41 deletions(-) diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 11ef0266c..c8d0c0f1d 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -540,38 +540,48 @@ export default function Wrapper({ initialSettings, fallback }) { html.classList.add(desiredThemeClass); } - // Remove any previously applied inline styles - body.style.backgroundImage = ""; - body.style.backgroundColor = ""; - body.style.backgroundAttachment = ""; + if (backgroundImage) { + const safeBackgroundImage = backgroundImage.replace(/'/g, "\\'"); + body.style.backgroundImage = `linear-gradient(rgb(var(--bg-color) / ${opacity}), rgb(var(--bg-color) / ${opacity})), url('${safeBackgroundImage}')`; + body.style.backgroundSize = "cover"; + body.style.backgroundPosition = "center"; + body.style.backgroundAttachment = "fixed"; + body.style.backgroundRepeat = "no-repeat"; + body.style.backgroundColor = ""; + } else { + body.style.backgroundImage = "none"; + body.style.backgroundColor = "rgb(var(--bg-color))"; + body.style.backgroundSize = ""; + body.style.backgroundPosition = ""; + body.style.backgroundAttachment = ""; + body.style.backgroundRepeat = ""; + } + + return () => { + body.style.backgroundImage = ""; + body.style.backgroundColor = ""; + body.style.backgroundSize = ""; + body.style.backgroundPosition = ""; + body.style.backgroundAttachment = ""; + body.style.backgroundRepeat = ""; + }; }, [backgroundImage, opacity, theme, color, initialSettings.color]); return ( - <> - {backgroundImage && ( -