mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 14:26:41 +02:00
- Rename entire quote project to zitare (German name) - Add global search page with quote and author search - Add search to navigation with Cmd/Ctrl+K shortcut - Add missing icons to PillNavigation (heart, list, compass) - Update all package names from @quote/* to @zitare/* - Update env variables from QUOTE_* to ZITARE_* - Update CLAUDE.md documentation - Fix layout with flex container structure 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
35 lines
937 B
TypeScript
35 lines
937 B
TypeScript
import { writable } from 'svelte/store';
|
|
import { browser } from '$app/environment';
|
|
|
|
export type Theme = 'light' | 'dark';
|
|
|
|
function createThemeStore() {
|
|
const { subscribe, set, update } = writable<Theme>('light');
|
|
|
|
return {
|
|
subscribe,
|
|
set,
|
|
toggle: () => {
|
|
update((current) => {
|
|
const newTheme = current === 'light' ? 'dark' : 'light';
|
|
if (browser) {
|
|
localStorage.setItem('theme', newTheme);
|
|
document.documentElement.setAttribute('data-theme', newTheme);
|
|
}
|
|
return newTheme;
|
|
});
|
|
},
|
|
init: () => {
|
|
if (browser) {
|
|
const savedTheme = localStorage.getItem('theme') as Theme | null;
|
|
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
const initialTheme = savedTheme || (prefersDark ? 'dark' : 'light');
|
|
|
|
document.documentElement.setAttribute('data-theme', initialTheme);
|
|
set(initialTheme);
|
|
}
|
|
},
|
|
};
|
|
}
|
|
|
|
export const theme = createThemeStore();
|