Fix error in theme switcher
This commit is contained in:
		
							parent
							
								
									ab61ad1a67
								
							
						
					
					
						commit
						a84195497e
					
				
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -18,6 +18,7 @@ function changeFavicon() { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function changeTheme(useLight) { | function changeTheme(useLight) { | ||||||
|  |   console.log({ useLight }) | ||||||
|   document.documentElement.classList.remove('light-theme', 'dark-theme', 'has-light-text', 'has-dark-text') |   document.documentElement.classList.remove('light-theme', 'dark-theme', 'has-light-text', 'has-dark-text') | ||||||
|   if (useLight) { |   if (useLight) { | ||||||
|     document.documentElement.classList.add('light-theme', 'has-dark-text') |     document.documentElement.classList.add('light-theme', 'has-dark-text') | ||||||
| @ -28,7 +29,7 @@ function changeTheme(useLight) { | |||||||
|   if (window.localStorage) { |   if (window.localStorage) { | ||||||
|     window.localStorage.setItem( |     window.localStorage.setItem( | ||||||
|         "lightTheme", |         "lightTheme", | ||||||
|         useLight) |         useLight ? "light" : "dark") | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   changeFavicon() |   changeFavicon() | ||||||
| @ -38,8 +39,10 @@ themeToggle.addEventListener("click", () => { | |||||||
|   changeTheme(document.documentElement.classList.contains('dark-theme')) |   changeTheme(document.documentElement.classList.contains('dark-theme')) | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| if (localTheme instanceof Boolean) { | console.log({ localTheme, isOSLight }) | ||||||
|   changeTheme(localTheme) | 
 | ||||||
|  | if (localTheme === "light") { | ||||||
|  |   changeTheme(true) | ||||||
| } else { | } else { | ||||||
|   changeTheme(isOSLight) |   changeTheme(isOSLight) | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user