- Declare
theme
cookie in theapp.vue
. - Use
HTML
nuxt builtin to binddata-theme
attribute (your may differ) to thecookie.theme
. - Create
theme.store.ts
Pinia store.cycle
function cycles through the list of modes and sets current state in thetheme
cookie - Create
ThemeSwitcher.vue
component.
This approach is universal, SSR friendly and easy adoptable.
Read more about useColorMode