()
| 5 | export type CodeThemeType = typeof srcbookLight | typeof srcbookDark; |
| 6 | |
| 7 | export function getTheme(): ThemeType { |
| 8 | const theme = localStorage.getItem('sb:theme'); |
| 9 | |
| 10 | if (theme === 'light' || theme === 'dark') { |
| 11 | return theme; |
| 12 | } |
| 13 | |
| 14 | return 'dark'; |
| 15 | } |
| 16 | |
| 17 | function persistTheme(theme: ThemeType) { |
| 18 | localStorage.setItem('sb:theme', theme); |