Tired of bright white Gmail hurting your eyes at night? Gmail Auto Dark Mode automatically gives Gmail a dark theme whenever your operating system is in dark mode — and switches back to light the moment you do.
- Zero effort. No buttons, no settings. Just install it and it follows your OS preference automatically.
- Real-time switching. Change your system theme and Gmail updates instantly — no page reload needed.
- Images stay true. Photos and videos are counter-inverted so they always look the way they should.
- Survives Gmail navigation. A smart observer reapplies the theme after Gmail's internal page transitions so dark mode never unexpectedly disappears.
- No permissions required. The extension cannot read your emails, access your account, or communicate with any server. Everything runs locally in your browser.
- Tiny footprint. A single lightweight script — no background processes, no memory overhead.
The extension injects a CSS filter: invert(1) hue-rotate(180deg) rule into Gmail as soon as the page loads. It reads the OS-level color preference (prefers-color-scheme) via the standard Web API and listens for changes in real time. Images, videos, and canvases are counter-inverted to restore their original appearance. A MutationObserver watches for Gmail's SPA navigation and reapplies the theme if it is ever removed.
To activate dark mode, make sure your OS is set to dark mode (see How to enable dark mode on your OS below).
- Clone or download this repository.
- Open Chrome and go to
chrome://extensions. - Enable Developer mode (top-right toggle).
- Click Load unpacked and select the
extension/subfolder (not the repo root).
The extension activates automatically when your system is set to dark mode. Here's how to switch on each platform:
- Open System Settings (Apple menu → System Settings).
- Go to Appearance.
- Select Dark (or Auto to follow sunrise/sunset).
- Open Settings (Win + I).
- Go to Personalization → Colors.
- Under Choose your mode, select Dark.
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'To switch back to light mode:
gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'Alternatively, use Settings → Appearance and select Dark.
This extension requests no permissions. It only injects CSS into https://mail.google.com/* and reads the system color scheme — no data is collected or transmitted.
This extension collects no user data whatsoever. All processing happens locally in your browser. See the full Privacy Policy.
Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change.
Packaging the extension:
zip -r gmail-auto-dark-mode.zip extension/
