Applies and maintains the dark theme on Wikipedia (Vector/Minerva), without white flash and local persistence.
This userscript enforces and preserves Wikipedia’s dark theme across page reloads and navigations. It works with both Vector (desktop) and Minerva (mobile) skins, prevents the initial white flash with inline anti-flash CSS, and keeps the UI consistent even when the DOM changes dynamically.
The goal is to deliver a comfortable, distraction-free dark reading experience that simply sticks.
skin-theme-clientpref-night class and updates skin query params.?vectornightmode=1 (desktop) and ?minervanightmode=1 (mobile).document-start to avoid the white flash.wikimedia-ui-theme=dark in localStorage.prefers-color-scheme.@updateURL.Install a userscript manager:
Click here to install the script:
Wikipedia Dark Theme Automatic
Confirm the installation when prompted by your userscript manager.
wikipedia-dark-theme-automatic.user.jsScript header (auto-update ready):
@homepageURL https://github.com/ImElio/wikipedia-dark-theme-automatic
@supportURL https://github.com/ImElio/wikipedia-dark-theme-automatic/issues
@updateURL https://raw.githubusercontent.com/ImElio/wikipedia-dark-theme-automatic/main/wikipedia-dark-theme-automatic.user.js
@downloadURL https://raw.githubusercontent.com/ImElio/wikipedia-dark-theme-automatic/main/wikipedia-dark-theme-automatic.user.js
Q: Will this interfere with Wikipedia’s own theme selector?
A: The script forces dark mode by default for consistency. You can switch it to “Automatic (OS)” in the config, or temporarily disable the script from your userscript manager.
Q: Does it modify my account settings?
A: No. It only affects your local browser session. It doesn’t change server-side preferences.
Q: Will it break the layout or images?
A: It only tweaks classes/theme assets and adds minimal anti-flash CSS. If you notice a theme glitch on a particular language wiki, please open an issue.
Q: Does it work on mobile?
A: Yes—Minerva skin is supported. The script adds ?minervanightmode=1 when needed.
Q: How do I stop the anti-flash black background?
A: Set ANTI_FLASH_INLINE_CSS to false in the config at the top of the script.
This project is licensed under the MIT License.
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址