I'm currently in the process of implementing a dark theme on my website, and my current method involves using 2 style sheets:
<link rel="stylesheet" type="text/css" href="/flatly.css">
<link rel="stylesheet" type="text/css" href="/darkly.css">
After that, I add or remove the "disabled" attribute to the darkly css link to enable or disable the dark theme.
While this approach does work, there is a slight lag in rerendering every time I toggle the dark theme due to a new network request being made to download the darkly.css file.
Is there a way to avoid this issue?