PageSourceSearch

https://imaginalapp.space/theme-init.js

js imaginalapp.space collected 2026-09-29 22:06:35 UTC 894 bytes, 15 lines download raw bytes

1// Applies the theme before first paint (no flash). Follows the OS appearance by
2// default (per Apple's HIG); an explicit Light/Dark choice, once made, overrides it.
3// Kept external so the app can run under a strict CSP (script-src 'self').
4(function () {
5  try {
6    var pref = localStorage.getItem('imaginal-theme'); // 'light' | 'dark' | null (=system)
7    var sys = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
8    var t = (pref === 'light' || pref === 'dark') ? pref : sys;
9    document.documentElement.dataset.theme = t;
10    var m = document.querySelector('meta[name="theme-color"]');
11    if (m) m.content = t === 'light' ? '#f3eff9' : '#0a0913';
12    var s = document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');
13    if (s) s.content = t === 'light' ? 'default' : 'black-translucent';
14  } catch (e) {}
15})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.