diff --git a/frontend/index.html b/frontend/index.html index 620c64c2..e3a61e73 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -5,6 +5,43 @@ PicPeak - Photo Sharing Platform + +
diff --git a/frontend/src/contexts/ThemeContext.tsx b/frontend/src/contexts/ThemeContext.tsx index a81fc6b6..72dea3ce 100644 --- a/frontend/src/contexts/ThemeContext.tsx +++ b/frontend/src/contexts/ThemeContext.tsx @@ -62,6 +62,21 @@ export const ThemeProvider: React.FC = ({ if (themeConfig.backgroundColor) { root.style.setProperty('--color-background', themeConfig.backgroundColor); + + // Cache the resolved background by slug so the next visit can + // apply it from the inline bootstrap in index.html before React + // mounts (#358 — eliminates the white flash on dark-theme galleries). + try { + const m = window.location.pathname.match(/\/gallery\/([^/?#]+)/); + if (m && m[1]) { + localStorage.setItem( + `gallery-theme-bg-${decodeURIComponent(m[1])}`, + themeConfig.backgroundColor + ); + } + } catch { + /* ignore — caching is best-effort */ + } } if (themeConfig.textColor) {