nextra
nextra copied to clipboard
[nextra-theme-blog] Allow forcing a theme
I wasn't able to override the system theme with some script and figured this would be a good way to force it if you want light or dark. Currently, it defaults to system preference even with darkMode
set to false
or not configured.
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/shuding/nextra/4Yw5gQzHMknA5qtbkGqWNRRoZuyT
✅ Preview: Canceled
Tested this locally with modifying examples/blog/theme.config.js
with:
forceTheme: 'light'
And running this and confirmed that even with system preference of dark, it defaults to light:
pnpm build:theme-blog
pnpm dev:theme-blog
@shuding Given that the darkMode
flag only gives the toggle button (system theme is enabled by default), would you be open to renaming that to themeToggle
and using a general theme
config option that defaults to system
but allows you to choose either light
or dark
explicitly?
+1 - would love to be able to set the default to dark (using docs theme in my case)