You could import and use the dark mode on the 'home page' and then render it and change the route in base to the page opened (so you don't have to apply the dark mode to every page and may have some bugs or more lines to check)