- Declare
themecookie in theapp.vue. - Use
HTMLnuxt builtin to binddata-themeattribute (your may differ) to thecookie.theme. - Create
theme.store.tsPinia store.cyclefunction cycles through the list of modes and sets current state in thethemecookie - Create
ThemeSwitcher.vuecomponent.
This approach is universal, SSR friendly and easy adoptable.
Read more about useColorMode