If it was backend-powered I could check a cookie, but the site is static. Since I made it dark-mode-first, I think it's a good compromise. Looking for other ideas too
We'll you could use the HTML element for the class. The other day I did an example for a client this way:
<html class="default">
<head>
<script>
if( localStorage.getItem('dark-mode') !== null ) { document.documentElement.classList.add('dark-mode'); }
</script>
Well I'm doing a PWA with LIGHT as default theme, but a dark-to-light flash doesn't bother anyone who wants light, but a light-to-dark flash means a lot to someone who prefers dark.