Skip to content

Instantly share code, notes, and snippets.

@StackTrac3
Last active May 25, 2022 20:13
Show Gist options
  • Save StackTrac3/ffd4c447580f72b3d1e8188a84955aa5 to your computer and use it in GitHub Desktop.
Save StackTrac3/ffd4c447580f72b3d1e8188a84955aa5 to your computer and use it in GitHub Desktop.
Greasemonkey script for darkening your web browser
// ==UserScript==
// @name Webkit's filter may globally dim
// @description web pages in a pleasing manner
// @grant GM_addStyle
// @run-at document-end
// @exclude *://*.github.com/*
// @exclude *://github.com/*
// ==/UserScript==
function addStyle(css) {
var head = document.getElementsByTagName("head")[0]
if (!head) return
var style = document.createElement("style")
style.innerHTML = css
head.appendChild(style)
}
addStyle(
"html { filter: brightness(70%); -webkit-filter: brightness(70%); -moz-filter: brightness(70%); }"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment