A simple and easy-to-use Chrome browser extension that can quickly toggle dark mode for any webpage.
- π One-click toggle - Click the extension icon to toggle dark mode for the current webpage
- πΎ State persistence - Dark mode settings for each website are saved
- π Domain-level control - Option to apply settings to all pages under the entire domain
- π¨ Smart adaptation - Automatically handles images, videos, and existing dark themes
- β‘ Performance optimized - Uses CSS filter technology for rapid response
- π Real-time sync - Multiple tab states sync in real-time
- π― Precise control - Supports reset functionality and keyboard shortcuts
- Download or clone this project to your local machine
- Open Chrome browser and go to
chrome://extensions/ - Enable "Developer mode" in the top right corner
- Click "Load unpacked extension"
- Select the project folder (directory containing manifest.json)
- Extension installation complete!
- Toggle dark mode: Click the extension icon in the browser toolbar
- Check status: The extension popup shows the current website's dark mode status
- Apply to entire domain: Check "Apply to entire domain" option to apply settings to all pages under the same domain
- Reset settings: Click "Reset Settings" button in the popup to clear current website or domain settings
- Space key: Press space in the extension popup to toggle dark mode
- Cmd/Ctrl + R: Press in the extension popup to reset settings
- Uses intelligent CSS style replacement instead of simple filter inversion
- Directly sets background color to dark (#121212, #1e1e1e) and text color to light (#e8e6e3)
- Maintains original display effects for images, videos, and other media elements
- Uses Chrome Extension Manifest V3
- Intelligently handles inline styles and dynamic content
- Color mapping: Maps white backgrounds to dark colors, black text to light colors
- Media protection: Images and videos maintain original colors, only adjusting opacity
- Smart detection: Automatically identifies and handles inline styles
- Dynamic adaptation: Monitors DOM changes and applies dark mode to new elements in real-time
- Performance optimization: Uses CSS variables and efficient selectors
dark-mode/
βββ manifest.json # Extension configuration file
βββ popup/ # Extension popup interface
β βββ popup.html
β βββ popup.css
β βββ popup.js
βββ content/ # Content scripts
β βββ content.js # Main dark mode logic
β βββ dark-mode.css # Dark mode styles
βββ background/ # Background script
β βββ background.js
βββ icons/ # Extension icons
β βββ icon.svg
β βββ icon16.png
β βββ icon32.png
β βββ icon48.png
β βββ icon128.png
βββ README.md # Documentation
- β Chrome 88+
- β Edge 88+
- β Other Chromium-based browsers
The extension has special optimizations for the following websites:
- GitHub
- GitLab
- Zhihu
- Twitter/X
- YouTube
- Stack Overflow
- Wikipedia
A: You can click the "Reset Settings" button, or use the native dark mode on that website.
A: No, the extension automatically maintains original colors for images and videos.
A: This issue has been fixed in the new version. If you still encounter it, please:
- Refresh the page to reload the extension
- Click the reset button to clear settings
- Reinstall the extension
A: Currently settings are only saved locally and do not support cross-device sync.
A: Go to chrome://extensions/ page, find the extension, and click "Remove".
A: The extension automatically skips websites and elements that already have dark themes to avoid double inversion.
After installing the extension, you can test dark mode effects on any webpage:
- Visit any webpage (like Baidu, GitHub, Weibo, etc.)
- Click the extension icon to enable dark mode
- Check if various elements display correctly
- Node.js 16+
- Chrome 88+
- Click "Reload" in the extension management page to update the extension
- Right-click extension icon β "Inspect popup" to debug popup
- Press F12 on the webpage β Console to view content script logs
- In
chrome://extensions/click "Background page" to debug background script
- Modify
content/content.jsto adjust dark mode algorithm - Modify
popup/popup.cssto customize popup styles - Modify
content/dark-mode.cssto add specific website adaptations
MIT License
Copyright (c) 2025-2026 Mario Studio
See LICENSE file for details
Issues and Pull Requests are welcome!
- Initial version
- Basic dark mode toggle functionality
- State persistence storage
- Smart media element handling