PWA edge-to-edge : theme-color accordé au fond selon le thème
Build and Publish Docker Image / build-and-push-image (push) Successful in 59s

Les barres système (statut/navigation) affichaient des bandes ne
correspondant pas au fond de l'app. La meta theme-color est désormais
mise à jour dynamiquement selon le thème (navy en sombre, clair en clair),
et le manifeste + index.html passent en navy. Les barres se fondent avec
l'app (rendu edge-to-edge).

Note : réinstaller la PWA pour appliquer le nouveau manifeste.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Zed
2026-07-12 22:06:49 +02:00
parent 5399218121
commit 74351b24d2
3 changed files with 35 additions and 8 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
name="viewport" name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
/> />
<meta name="theme-color" content="#0f766e" /> <meta name="theme-color" content="#0b1120" />
<meta <meta
name="description" name="description"
content="Skori — Gestion des scores pour vos jeux de société : Skyjo, Azul, Cabo, Harmonies, Odin." content="Skori — Gestion des scores pour vos jeux de société : Skyjo, Azul, Cabo, Harmonies, Odin."
+33 -6
View File
@@ -39,15 +39,42 @@ export const useAppStore = create<AppState>((set) => ({
} }
})); }));
// Status/navigation bar colour per theme so the PWA reads edge-to-edge
// (the system bars blend with the app background instead of showing bands).
const THEME_COLORS = { dark: '#0b1120', light: '#e6f7f4' } as const;
function setThemeColorMeta(effective: 'light' | 'dark') {
let meta = document.querySelector(
'meta[name="theme-color"]',
) as HTMLMetaElement | null;
if (!meta) {
meta = document.createElement('meta');
meta.name = 'theme-color';
document.head.appendChild(meta);
}
meta.content = THEME_COLORS[effective];
}
function applyTheme(theme: 'light' | 'dark' | 'system') { function applyTheme(theme: 'light' | 'dark' | 'system') {
const root = window.document.documentElement; const root = window.document.documentElement;
root.classList.remove('light', 'dark'); root.classList.remove('light', 'dark');
if (theme === 'system') { const effective =
const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; theme === 'system'
root.classList.add(systemTheme); ? window.matchMedia('(prefers-color-scheme: dark)').matches
return; ? 'dark'
} : 'light'
: theme;
root.classList.add(theme); root.classList.add(effective);
setThemeColorMeta(effective);
}
// Keep the theme in sync when the OS theme changes (only when set to "system").
if (typeof window !== 'undefined') {
window
.matchMedia('(prefers-color-scheme: dark)')
.addEventListener('change', () => {
if (useAppStore.getState().theme === 'system') applyTheme('system');
});
} }
+1 -1
View File
@@ -19,7 +19,7 @@ export default defineConfig({
scope: "/", scope: "/",
display: "standalone", display: "standalone",
orientation: "portrait", orientation: "portrait",
theme_color: "#0f766e", theme_color: "#0b1120",
background_color: "#0b1120", background_color: "#0b1120",
categories: ["games", "utilities"], categories: ["games", "utilities"],
icons: [ icons: [