mealie/frontend/plugins/dark-mode.client.ts
Michael Genson a22d500603
fix: CSS rendering bug, again (#2555)
* idk man

* that wasn't supposed to be there
2023-09-19 09:07:08 -08:00

14 lines
506 B
TypeScript

import { Plugin } from "@nuxt/types"
import { useDark } from "@vueuse/core";
const darkModePlugin: Plugin = ({ $vuetify }, _) => {
const isDark = useDark();
// Vuetify metadata is bugged and doesn't render dark mode fully when called immediately
// Adding a 100 millisecond delay fixes this problem
// https://stackoverflow.com/questions/69399797/vuetify-darkmode-colors-wrong-after-page-reload
setTimeout(() => { $vuetify.theme.dark = isDark.value; }, 100);
};
export default darkModePlugin;