mirror of
https://github.com/we-promise/sure.git
synced 2026-04-26 23:44:12 +00:00
fix: Check user's theme preference during page load (#156)
This commit is contained in:
5
app/views/layouts/_dark_mode_check.html.erb
Normal file
5
app/views/layouts/_dark_mode_check.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<script>
|
||||
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
||||
document.documentElement.setAttribute("data-theme", "dark");
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user