feat(pwa): loading screen in the colours of the last used theme
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
57a97a3750
commit
4a923eaf01
5 files changed
+52
-7
No files matched your search
@@ -0,0 +1,17 @@
|
||||
// Runs before the first paint: the loading screen takes the colours of the theme used last on this
|
||||
// device (stored by the app in lib/theme.ts), so a light or orange theme does not start in blue.
|
||||
// A file instead of an inline script so the CSP can stay at script-src 'self'.
|
||||
(function () {
|
||||
try {
|
||||
var colors = JSON.parse(localStorage.getItem('mindsift_boot_colors') || 'null');
|
||||
if (!colors || typeof colors.bg !== 'string' || typeof colors.accent !== 'string') return;
|
||||
var root = document.documentElement;
|
||||
root.style.setProperty('--boot-bg', colors.bg);
|
||||
root.style.setProperty('--boot-accent', colors.accent);
|
||||
if (typeof colors.onAccent === 'string') root.style.setProperty('--boot-on-accent', colors.onAccent);
|
||||
var meta = document.querySelector('meta[name="theme-color"]');
|
||||
if (meta) meta.setAttribute('content', colors.bg);
|
||||
} catch (e) {
|
||||
// no storage: the loading screen stays blue
|
||||
}
|
||||
})();
|
||||
@@ -7,7 +7,7 @@
|
||||
// would hand it the old values), the cache only offline.
|
||||
// - API requests are never touched; offline data comes from the app's own cache (lib/offline.ts).
|
||||
// Raise VERSION when this file changes in a way that needs fresh caches.
|
||||
const VERSION = 'v5';
|
||||
const VERSION = 'v6';
|
||||
const SHELL_CACHE = `mindsift-shell-${VERSION}`;
|
||||
const ASSET_CACHE = `mindsift-assets-${VERSION}`;
|
||||
const MAX_ASSETS = 80;
|
||||
@@ -23,6 +23,8 @@ const SHELL_URLS = [
|
||||
'/icon-512x512.png',
|
||||
'/apple-touch-icon.png',
|
||||
'/badge-96x96.png',
|
||||
'/boot-theme.js',
|
||||
'/pwa-install.js',
|
||||
];
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
|
||||
Reference in new issue
Block a user