mirror of
				https://github.com/imfing/hextra.git
				synced 2025-11-03 20:04:54 -05:00 
			
		
		
		
	Merge branch 'main' into image-zoom
This commit is contained in:
		
							
								
								
									
										6
									
								
								assets/js/head/banner.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								assets/js/head/banner.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
// The section must not be in the banner.js (body) file because it can create a quick flash.
 | 
			
		||||
 | 
			
		||||
if (localStorage.getItem('{{ site.Params.banner.key | default `banner-closed` }}')) {
 | 
			
		||||
  document.documentElement.style.setProperty("--hextra-banner-height", "0px");
 | 
			
		||||
  document.documentElement.classList.add("hextra-banner-hidden");
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										14
									
								
								assets/js/head/theme.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								assets/js/head/theme.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
// The section must not be in the theme.js (body) file because it can create a quick flash (switch between light and dark).
 | 
			
		||||
 | 
			
		||||
function setTheme(theme) {
 | 
			
		||||
  document.documentElement.classList.remove("light", "dark");
 | 
			
		||||
 | 
			
		||||
  if (theme !== "light" && theme !== "dark") {
 | 
			
		||||
    theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  document.documentElement.classList.add(theme);
 | 
			
		||||
  document.documentElement.style.colorScheme = theme;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
setTheme("color-theme" in localStorage ? localStorage.getItem("color-theme") : '{{ site.Params.theme.default | default `system`}}')
 | 
			
		||||
		Reference in New Issue
	
	Block a user