Comments (5)
Hi @katerlouis
Actually this is not possible for Nuxt 2 since we use router.beforeEach
to force the color mode before navigating: https://github.com/nuxt-community/color-mode-module/blob/2ca9edc4f2f55970a8f147565eb49c8d84f8157a/lib/templates/plugin.client.js#L91-L105
We cannot have the asyncData
result inside, this could work in Nuxt 3 since we use <Suspense>
.
from color-mode.
Do you think this could work when using Nuxt bridge? I'm not sure if Suspense is also supported in Nuxt bridge.
from color-mode.
It might be possible, but still a bit early to say.
from color-mode.
@Atinux Any chance I'm lucky and it is possible today? Because we are still very much in Need for this. :(
I would offer my help to contribute (if I get a kick start on it, I think I am capable of helping 8))
(We can't run Nuxt-bridge, though... we however do have @nuxtjs/composition-api up and running)
EDIT: Just an idea, – does it need to come from asyncData
? Or could the initial color mode technically be pulled from a store state based on the routes path? I could cook up a route-to-colormode-map that gets pulled in nuxtServerInit
.
from color-mode.
@Atinux I won't give up! :D
AI chat bot Phind had some pretty good ideas and even had me in hope at some point.
Interesting conversation: https://www.phind.com/search?cache=64d5f47a-5a8c-44d3-9bf1-cd7bada8c9fb
from color-mode.
Related Issues (20)
- Not change body class
- More color modes
- SSR - Hydration text mismatch HOT 2
- Throws Error about accessing `preference` of `undefined` HOT 4
- Dark theme cannot be loaded
- allow disabling css transitions while changing color scheme
- Get color-theme while server render HOT 2
- Forced color mode incorrect timing
- Adding class "theme-red" to <html> breaks color-mode
- Load color-mode already in spa template
- helper.getColorScheme is not a function error when trying to use the module HOT 7
- Can I use only data value?
- Selected Color dosn't save on LocalStorage
- Question about demo asset regarding license HOT 2
- On light mode background-color is transparent HOT 1
- Document how to force color mode dynamically (e.g. from a useFetch response) HOT 6
- Color of element stuck in 1 color.
- Reactive `useColorMode()` value HOT 1
- tailwind module integration breaks dark mode HOT 7
- Support set html attribute HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from color-mode.