A simple Chrome extension that allows you to toggle dark mode on any website with an easy-to-use on/off switch.
- 🌙 Universal Dark Mode: Works on any website
- 🔄 Simple Toggle: Easy on/off switch in the extension popup
- 💾 Persistent Settings: Remembers your preference for each website
- 🖼️ Smart Media Handling: Automatically adjusts images and videos for better visibility
- ⚡ Lightweight: Minimal performance impact
- 🎨 Modern UI: Clean and intuitive popup interface
- Clone or download this repository
- Open Chrome and navigate to
chrome://extensions/
- Enable "Developer mode" in the top right corner
- Click "Load unpacked" and select the extension directory
- The extension will appear in your Chrome toolbar
- Click the Dark Mode Toggle extension icon in your Chrome toolbar
- Use the toggle switch to enable/disable dark mode for the current website
- The extension will remember your preference for each website
- Toggle as needed on different websites
The extension uses a combination of:
- CSS Filters: Applies
invert()
andhue-rotate()
filters to create dark mode - Smart Targeting: Specifically handles images, videos, and media elements
- Content Scripts: Injects dark mode styles into web pages
- Chrome Storage API: Saves preferences per website
- Service Worker: Manages extension state and tab updates
- Manifest Version: 3 (latest Chrome extension standard)
- Permissions:
activeTab
,storage
- Content Script: Runs on all URLs (
<all_urls>
) - Service Worker: Handles background tasks and state management
- Chromium browser
- Basic knowledge of JavaScript, HTML, and CSS
- Load the extension in developer mode
- Navigate to any website
- Click the extension icon and test the toggle
- Verify dark mode is applied correctly
- Check that preferences persist across page reloads
You can customize the dark mode behavior by modifying:
content.js
: Adjust the CSS filter values or add custom styling logicdarkmode.css
: Add additional CSS rules for specific elementspopup.html/css
: Customize the popup interface appearance
- Chrome 88+ (Manifest V3 support required)
- Chromium-based browsers (Edge, Brave, etc.)
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.
- Some websites with complex styling may require additional CSS adjustments
- Video players with custom controls might not invert properly
- Canvas elements may need special handling
- Custom dark mode themes
- Website-specific exclusions
- Keyboard shortcuts
- Automatic dark mode based on system preferences
- Advanced filter options