]> git.immae.eu Git - github/bastienwirtz/homer.git/blobdiff - src/components/DarkMode.vue
select environments
[github/bastienwirtz/homer.git] / src / components / DarkMode.vue
index 80491fafae8d2dc9fb6f467146cac0e7db8495a8..677238acbd101bdf4683e554b66b6a4a0028f2ba 100644 (file)
@@ -15,6 +15,9 @@
 <script>
 export default {
   name: "Darkmode",
+  props: {
+    defaultValue: String,
+  },
   data: function () {
     return {
       isDark: null,
@@ -30,6 +33,17 @@ export default {
     if ("overrideDark" in localStorage) {
       // Light theme is 1 and Dark theme is 2
       this.mode = JSON.parse(localStorage.overrideDark) ? 2 : 1;
+    } else {
+      switch (this.defaultValue) {
+        case "light":
+          this.mode = 1;
+          break;
+        case "dark":
+          this.mode = 2;
+          break;
+        default:
+          this.mode = 0;
+      }
     }
     this.isDark = this.getIsDark();
     this.$emit("updated", this.isDark);