Skip to content

Instantly share code, notes, and snippets.

@asontu
Last active May 16, 2024 23:15
Show Gist options
  • Save asontu/6c00e82739637a926a70a912a97c35eb to your computer and use it in GitHub Desktop.
Save asontu/6c00e82739637a926a70a912a97c35eb to your computer and use it in GitHub Desktop.
javascript:(function(){
var styleTag = document.querySelector('#niftyStyle');
if (!styleTag) {
styleTag = document.createElement('style');
styleTag.id = 'niftyStyle';
styleTag.type = 'text/css';
styleTag.contentEditable = 'plaintext-only';
styleTag.style.position = 'fixed';
styleTag.style.top = '0';
styleTag.style.minHeight = '1em';
styleTag.style.minWidth= '4em';
styleTag.style.zIndex = '99999';
styleTag.style.padding = '3px';
styleTag.style.whiteSpace = 'pre';
styleTag.style.background = '#000';
styleTag.style.color = '#fff';
styleTag.style.fontFamily = 'consolas, monospace';
document.body.appendChild(styleTag);
}
if (!styleTag.innerText.trim()) {
var sheet = localStorage.getItem('niftyStyle');
if (!sheet) {
sheet = 'html {\n filter: invert(1) hue-rotate(180deg);\n}';
styleTag.style.display = 'block';
}
styleTag.appendChild(document.createTextNode(sheet));
return;
}
if (styleTag.style.display == 'block') {
localStorage.setItem('niftyStyle', styleTag.innerText.trim());
styleTag.style.display = 'none';
} else {
styleTag.style.display = 'block';
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment