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

---
 components/FilePreview.vue | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'components/FilePreview.vue')

diff --git a/components/FilePreview.vue b/components/FilePreview.vue
index 3892857..878ca5b 100644
--- a/components/FilePreview.vue
+++ b/components/FilePreview.vue
@@ -8,13 +8,13 @@
       v-else-if="isStl(path)"
       :rotate="rotate"
       :src="baseAPI + '' + path"
-      :backgroundColor="bg ? bg : '#D1D5DB'"
+      :backgroundColor="color ? color : '#D1D5DB'"
       :controlsOptions="{'enablePan': controls ? true : false, 'enableZoom': controls ? true : false, 'enableRotate': controls ? true : false}"
     )
     model-obj(
       v-else-if="isObj(path)"
       :src="baseAPI + '' + path"
-      :backgroundColor="bg ? bg : '#D1D5DB'"
+      :backgroundColor="color ? color : '#D1D5DB'"
       :controlsOptions="{'enablePan': controls ? true : false, 'enableZoom': controls ? true : false, 'enableRotate': controls ? true : false}"
     )
 </template>
@@ -33,6 +33,7 @@ export default {
         y: 0,
         z: 0,
       },
+      color: "",
     };
   },
   components: {
@@ -41,6 +42,11 @@ export default {
   },
   created() {
     this.baseAPI = this.$config.api;
+    if (this.$colorMode.preference == "light") {
+      this.color = this.bg;
+    } else {
+      this.color = "#ecfdf5";
+    }
   },
   methods: {
     checkExt(path, ext) {
-- 
cgit v1.2.3-71-g8e6c

