feat: dark mode

This commit is contained in:
Daniel Kempkens 2023-08-15 22:33:42 +02:00
parent 579dd239e7
commit 7931009e90
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM

View file

@ -14,5 +14,13 @@
<div class="container"> <div class="container">
<%= EEx.eval_file(embedded_template, embedded_args) %> <%= EEx.eval_file(embedded_template, embedded_args) %>
</div> </div>
<script>
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.documentElement.setAttribute('data-bs-theme', 'dark')
} else {
document.documentElement.setAttribute('data-bs-theme', 'light')
}
</script>
</body> </body>
</html> </html>