nextra icon indicating copy to clipboard operation
nextra copied to clipboard

[nextra-theme-blog] Allow forcing a theme

Open rgoomar opened this issue 3 years ago • 4 comments

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.

rgoomar avatar Jan 28 '22 05:01 rgoomar

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

vercel[bot] avatar Jan 28 '22 05:01 vercel[bot]

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

rgoomar avatar Jan 28 '22 05:01 rgoomar

@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?

rgoomar avatar Feb 17 '22 23:02 rgoomar

+1 - would love to be able to set the default to dark (using docs theme in my case)

gigamesh avatar Oct 02 '22 20:10 gigamesh