SPB Git

spb/spbgit Public MIT

SPB Git — the platform hosting itself

JavaScript 73.9% CSS 11.7% Nunjucks 11.6% Shell 2.7%
1.0 KB · 24 lines javascript
Raw Blame History
1/**2 * ─────────────────────────────────────────────3 *  SPB Git — Personal Git Platform4 * ─────────────────────────────────────────────5 *  Author  : Simon-Pierre Boucher6 *  Contact : contact@spboucher.ai7 *  File    : src/web/assets/js/theme-boot.js8 *  Purpose : Apply the persisted theme before first paint (no FOUC)9 *  License : MIT © Simon-Pierre Boucher10 * ─────────────────────────────────────────────11 */1213(function () {14  var stored = null;15  try {16    stored = localStorage.getItem('spbgit-theme');17  } catch (e) { /* private mode */ }18  var theme = stored;19  if (theme !== 'dark' && theme !== 'light') {20    theme = matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';21  }22  document.documentElement.setAttribute('data-theme', theme);23})();24