File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
packages/svelte-stores/src/lib Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @layerstack/svelte-stores ' : patch
3+ ---
4+
5+ fix(themeStore): Only manage system dark mode (` <html class="dark"> ` ) if there are any dark themes defined
Original file line number Diff line number Diff line change @@ -48,10 +48,13 @@ export function createThemeStore(options: ThemeStoreOptions): ThemeStore {
4848 let darkMatcher = window . matchMedia ( '(prefers-color-scheme: dark)' ) ;
4949
5050 function resolveSystemTheme ( { matches } : { matches : boolean } ) {
51- if ( matches && options . dark . length ) {
52- document . documentElement . classList . add ( 'dark' ) ;
53- } else {
54- document . documentElement . classList . remove ( 'dark' ) ;
51+ // Only manage dark mode (`<html class="dark">`) if there are any dark themes defined
52+ if ( options . dark . length ) {
53+ if ( matches ) {
54+ document . documentElement . classList . add ( 'dark' ) ;
55+ } else {
56+ document . documentElement . classList . remove ( 'dark' ) ;
57+ }
5558 }
5659
5760 store . set ( new CurrentTheme ( null , matches ) ) ;
You can’t perform that action at this time.
0 commit comments