mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
20 lines
482 B
TypeScript
20 lines
482 B
TypeScript
import { browser } from '$app/env';
|
|
import { writable } from 'svelte/store';
|
|
|
|
export type AppStore = {
|
|
theme: 'light' | 'dark' | 'auto';
|
|
themeInUse: 'light' | 'dark';
|
|
};
|
|
export const app = writable<AppStore>({
|
|
theme: 'auto',
|
|
themeInUse: 'light'
|
|
});
|
|
|
|
if (browser) {
|
|
app.update((n) => ({
|
|
...n,
|
|
...(JSON.parse(localStorage.getItem('appwrite')) ?? {})
|
|
}));
|
|
app.subscribe((u) => localStorage.setItem('appwrite', JSON.stringify(u) ?? '{}'));
|
|
}
|