From 6395d1ec4362fedd7854fc9a103bad8bf7ae5d3d Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Tue, 27 Sep 2022 19:17:51 +0200
Subject: Dark mode

---
 layouts/default.vue | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

(limited to 'layouts/default.vue')

diff --git a/layouts/default.vue b/layouts/default.vue
index 128a9c6..c6e249f 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -1,8 +1,24 @@
 <template>
-  <div>
+  <div :class="$colorMode.preference">
     <VHeader />
     <main>
       <Nuxt />
     </main>
   </div>
 </template>
+
+<script>
+export default {
+  created() {
+    setTimeout(() => {
+      const dark = document.querySelector("#__layout .dark");
+      console.log(dark);
+      if (dark) {
+        document.querySelector("body").className = "dark";
+      } else {
+        document.querySelector("body").className = "";
+      }
+    }, 1000);
+  },
+};
+</script>
-- 
cgit v1.2.3-71-g8e6c

