From 3eb6809e85b7f546465c1f11b745e0eda1c7ba1d Mon Sep 17 00:00:00 2001 From: Salem Yaslem Date: Tue, 6 Jun 2023 03:59:48 +0300 Subject: [PATCH] support dark mode --- app.vue | 26 ++++++++++++-------------- composables/files-manager.ts | 2 +- plugins/vuetify.ts | 8 +++++++- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/app.vue b/app.vue index 585b989..f20bdc9 100644 --- a/app.vue +++ b/app.vue @@ -144,8 +144,8 @@ function stepUp(path: string) { - + + + + diff --git a/composables/files-manager.ts b/composables/files-manager.ts index ff0e4fa..60bab1f 100644 --- a/composables/files-manager.ts +++ b/composables/files-manager.ts @@ -138,7 +138,7 @@ export class FilesManager { if (a.name > b.name) return 1; return 0; }), - isFolder: true, + isFolder: this.filesList.value.length ? true : false, }; } diff --git a/plugins/vuetify.ts b/plugins/vuetify.ts index 33811d3..5a3b57d 100644 --- a/plugins/vuetify.ts +++ b/plugins/vuetify.ts @@ -3,10 +3,16 @@ import * as components from 'vuetify/components' import * as directives from 'vuetify/directives' export default defineNuxtPlugin(nuxtApp => { + // get system dark mode + const darkMode = window.matchMedia('(prefers-color-scheme: dark)').matches + const vuetify = createVuetify({ ssr: false, components, - directives + directives, + theme: { + defaultTheme: darkMode ? 'dark' : 'light', + } }) nuxtApp.vueApp.use(vuetify)