Something went wrong. Try again.
Tea journaling on ATProto (alpha)
Something went wrong. Try again.
JavaScript
12345678910111213141516171819202122232425262728293031// Apply saved theme to document// Called on initial load (from head script), HTMX navigations, and history restoresfunction applyTheme() { var t = localStorage.getItem('arabica-theme'); if (t === 'dark' || t === 'light') { document.documentElement.setAttribute('data-theme', t); } else { document.documentElement.removeAttribute('data-theme'); }}
// Re-apply theme after HTMX swaps and history restoresdocument.addEventListener('htmx:afterSettle', applyTheme);document.addEventListener('htmx:historyRestore', applyTheme);
// Theme settings Alpine.js componentfunction themeSettings() { return { theme: localStorage.getItem('arabica-theme') || 'system', setTheme(value) { this.theme = value; if (value === 'system') { localStorage.removeItem('arabica-theme'); } else { localStorage.setItem('arabica-theme', value); } applyTheme(); } };}