theme: prevent flicker on first load

This commit is contained in:
Yehor 2024-09-29 15:52:14 +03:00
parent 188740129d
commit a6f2950a2a
1 changed files with 6 additions and 0 deletions

View File

@ -3,6 +3,12 @@
<footer>
<p> Copyright 2015 <a href="http://www.patriciogonzalezvivo.com" target="_blank">Patricio Gonzalez Vivo</a> </p>
</footer>
<script type="text/javascript">
// Setting the theme immediately inside the inline script prevents flicker
document.body.dataset.theme = localStorage.getItem('theme') || 'light';
</script>
<?php
echo '
<script type="text/javascript" src="'.$path.'/src/main.js" defer></script>';