Skip to content

Instantly share code, notes, and snippets.

@lorenzos
Last active September 26, 2019 02:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lorenzos/779a4947247e6fad9353cac91913d667 to your computer and use it in GitHub Desktop.
Save lorenzos/779a4947247e6fad9353cac91913d667 to your computer and use it in GitHub Desktop.
Userscript for making Discord sidebar in Light theme dark again, after September 2019 update.
// ==UserScript==
// @name Discord dark sidebar for Light theme
// @namespace Violentmonkey Scripts
// @match https://discordapp.com/*
// @grant none
// ==/UserScript==
var style = `
/*
Invert but keep hue on server lists (guilds) and sidebar.
- invert(100%): invert colors
- hue-rotate(180deg): restore the original hue of the inverted colors
*/
[class*="guilds-"],
[class*="sidebar-"] {
filter: invert(100%) hue-rotate(180deg);
}
/*
Try to restore original colors of server icons and user avatars.
Not perfect, looks like color vibrance is a bit lost somehow, but better than nothing.
*/
[class*="guilds-"] [class*="blobContainer-"] img,
[class*="sidebar-"] [class*="avatar-"] img {
filter: invert(100%) hue-rotate(180deg);
}
`;
ready = (fn) => {
if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading"){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
var run = () => {
((cssString) => {
var style = document.createElement('style');
style.innerHTML = cssString;
document.getElementsByTagName('head')[0].appendChild(style);
})(style);
};
ready(run);
run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment