export default defineNuxtPlugin((nuxtApp) => { const { $appHelpers } = nuxtApp; const themeCookie = useCookie<'light' | 'dark'>($appHelpers.COOKIES_THEME_KEY, { default: () => 'light', path: '/', }); const currentTheme = themeCookie.value || 'light'; if (import.meta.server) { const event = useRequestEvent(); if (event) { event.context.theme = currentTheme; } } if (import.meta.client) { const html = document.documentElement; if (currentTheme === 'dark') { html.classList.add('dark'); } else { html.classList.remove('dark'); } } });