how to add a darkmode toggle to switch css and remember it
So it seems the trend lately is to add darkmode to everything...
Its actually not that hard to switch style sheets and add a dark version of the same style, it seems to be a bit laggy in switching though as its quite a large script, but it does work.
This was actually harder than i thought, you can just switch out the whole style sheet, but if its a big one it flashes and then loads the alternate one after each page load.
So i had to add a function that replaced the class names with the dark version.
You can view the code here: