N13: How can I force one particular page to be in dark mode?
Answered
Champagne D’Argent posted this in #help-forum
Champagne D’ArgentOP
First off, is the recommended method for the page to pass props to the RootLayout? If not, is there a route-level configuration type of thing? If so, how can I pull that off? I've been searching for an hour and haven't figured it out.
Answered by Arinji
yea so you can have a theme provider with context and wrap your app in it
23 Replies
you cant send props back to the layout, you can edit them though
use context or if you want searchParams
then edit the url or update context and voila you edited the root layout
Champagne D’ArgentOP
so how can someone provide page level config?
well just create the context inside the layout and wrap your whole app with it
its like how you wrap your layout
American black bear
WDYM by force dark mode, just add dark background in css for that page?
Your question is lacking details
Champagne D’ArgentOP
I dont know how that can be more specific
he probably means setting a flag to true
Champagne D’ArgentOP
pretty much, yes
which sets the site to dark mode
yea so you can have a theme provider with context and wrap your app in it
Answer
American black bear
use next-themes?
Champagne D’ArgentOP
gotcha
@Champagne D’Argent gotcha
mark an answer if it has solved your question, helps us out more than you can believe :D
@Arinji mark an answer if it has solved your question, helps us out more than you can believe :D
American black bear
yes mark my answer as solution \jk
Original message was deleted
boop
Champagne D’ArgentOP
cool, thanks for the info
American black bear
so, solved it?
Champagne D’ArgentOP
as close as it will get, I believe
American black bear
noice, all the best ðŸ‘