Created
May 26, 2025 06:57
-
-
Save jwt625/8117de0bfe65a0e9b5ae1ce28eaaacc2 to your computer and use it in GitHub Desktop.
Chrome global dark mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Smart Global Dark Mode | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @description Apply dark mode on all sites except blacklisted ones | |
// @author You | |
// @match *://*/* | |
// @grant GM_addStyle | |
// ==/UserScript== | |
(function () { | |
'use strict'; | |
// List of domains to exclude (partial matches work) | |
const blacklist = [ | |
'example.com', | |
'docs.google.com', | |
'banking.com', | |
'x.com' | |
]; | |
const currentHost = window.location.hostname; | |
// Skip dark mode if current domain matches any blacklist entry | |
if (blacklist.some(domain => currentHost.includes(domain))) { | |
return; | |
} | |
// Inject dark mode styles | |
GM_addStyle(` | |
html, body { | |
background-color: #111 !important; | |
color: #ddd !important; | |
} | |
* { | |
background-color: transparent !important; | |
color: inherit !important; | |
border-color: #444 !important; | |
} | |
a { | |
color: #8ab4f8 !important; | |
} | |
input, textarea, select, button { | |
background-color: #222 !important; | |
color: #eee !important; | |
border-color: #555 !important; | |
} | |
img, video { | |
filter: brightness(0.85) contrast(1.1) !important; | |
} | |
::selection { | |
background: #555 !important; | |
color: #fff !important; | |
} | |
`); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment