0๐
2020 Update
This can be done easily with the @nuxtjs/color-mode library HERE is an example of this in action
- Add @nuxtjs/color-mode dependency to your project
- Add @nuxtjs/color-mode to the buildModules section of your nuxt.config.js
- Start theming your CSS with .dark-mode and .light-mode classes
You can edit it in nuxt.config.js
colorMode: {
preference: 'system', // default value of $colorMode.preference
fallback: 'light', // fallback value if not system preference found
hid: 'nuxt-color-mode-script',
globalName: '__NUXT_COLOR_MODE__',
componentName: 'ColorScheme',
cookie: {
key: 'nuxt-color-mode',
options: {
path: nuxt.options.router.base // https://nuxtjs.org/api/configuration-router#base
}
}
}
Source:stackexchange.com