Skip to content

Commit

Permalink
Update default colorscheme in theme store
Browse files Browse the repository at this point in the history
  • Loading branch information
m4tt72 committed Dec 31, 2023
1 parent 9a93414 commit 3df4d3b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/stores/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { writable } from 'svelte/store';
import themes from '../../themes.json';
import type { Theme } from '../interfaces/theme';

const defaultTheme: Theme = themes.find((t) => t.name === 'GruvboxDark')!;
const defaultColorscheme: Theme = themes.find((t) => t.name === 'GruvboxDark')!;

export const theme = writable<Theme>(
JSON.parse(localStorage.getItem('theme') || JSON.stringify(defaultTheme)),
JSON.parse(
localStorage.getItem('colorscheme') || JSON.stringify(defaultColorscheme),
),
);

theme.subscribe((value) => {
localStorage.setItem('theme', JSON.stringify(value));
localStorage.setItem('colorscheme', JSON.stringify(value));
});

0 comments on commit 3df4d3b

Please sign in to comment.