2022-01-09 07:15:23 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { Plugin } from "@nuxt/types"
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-04 16:06:24 -09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import { useDark } from "@vueuse/core";
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								const darkModePlugin: Plugin = ({ $vuetify }, _) => {
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-04 16:06:24 -09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  const isDark = useDark();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-12-04 13:30:02 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // Vuetify metadata is bugged and doesn't render dark mode fully when called immediately
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-19 12:07:08 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // Adding a 100 millisecond delay fixes this problem
							 | 
						
					
						
							
								
									
										
										
										
											2022-12-04 13:30:02 -06:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // https://stackoverflow.com/questions/69399797/vuetify-darkmode-colors-wrong-after-page-reload
							 | 
						
					
						
							
								
									
										
										
										
											2023-09-19 12:07:08 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  setTimeout(() => { $vuetify.theme.dark = isDark.value; }, 100);
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-04 16:06:24 -09:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-09 07:15:23 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								export default darkModePlugin;
							 |