mirror of
				https://github.com/jackyzha0/quartz.git
				synced 2025-11-04 04:59:49 +01:00 
			
		
		
		
	* Emit custom event when theme changes * Type themechange custom event * Update darkmode docs
		
			
				
	
	
	
		
			800 B
		
	
	
	
	
	
	
	
			
		
		
	
	
			800 B
		
	
	
	
	
	
	
	
title, tags
| title | tags | |
|---|---|---|
| Darkmode | 
  | 
Quartz supports darkmode out of the box that respects the user's theme preference. Any future manual toggles of the darkmode switch will be saved in the browser's local storage so it can be persisted across future page loads.
Customization
- Removing darkmode: delete all usages of 
Component.Darkmode()fromquartz.layout.ts. - Component: 
quartz/components/Darkmode.tsx - Style: 
quartz/components/styles/darkmode.scss - Script: 
quartz/components/scripts/darkmode.inline.ts 
You can also listen to the themechange event to perform any custom logic when the theme changes.
document.addEventListener("themechange", (e) => {
  console.log("Theme changed to " + e.detail.theme) // either "light" or "dark"
  // your logic here
})