svg / svgo.dev

https://svgo.dev/
MIT License
5 stars 3 forks source link

fix: dark mode when javascript disabled #5

Closed SethFalco closed 9 months ago

SethFalco commented 9 months ago

Docusaurus depends on JavaScript to handle theming, so users with JavaScript disabled would normally be stuck on light mode.

In our case, the website just looked broken because I used prefers-color-scheme for my styles instead of [data-theme=dark] so some dark mode styled would be applied while others wouldn't.

This adds a plugin which retroactively replaces selectors from [data-theme=dark] to prefers-color-scheme with PostCSS, which will improve the experience for users with JavaScript disabled.

Chores