Skip to content

Instantly share code, notes, and snippets.

@tobimori
Last active June 7, 2020 10:05
Show Gist options
  • Save tobimori/0daa6a1b332d756c5ddbcdaddb83b2a5 to your computer and use it in GitHub Desktop.
Save tobimori/0daa6a1b332d756c5ddbcdaddb83b2a5 to your computer and use it in GitHub Desktop.
🌈 Makes GitHub language tags funky! ✨ User script to replace the text color with the corresponding language color
// ==UserScript==
// @name BetterLinguistColors
// @namespace https://moeritz.io/
// @version 1.4.5
// @description Replaces the text color with the corresponding language color
// @author Tobias MΓΆritz
// @match *://github.com/*
// @run-at document-start
// ==/UserScript==
new MutationObserver(() => {
[...document.querySelectorAll('span.repo-language-color')].map((e) => {
e.parentNode.childNodes[3].style.color = e.style.backgroundColor;
});
[...document.querySelectorAll('span.color-block.language-color')].map((e) => {
e.parentNode.childNodes[3].style.color = e.style.backgroundColor;
e.parentNode.childNodes[5].style.color = e.style.backgroundColor;
e.parentNode.childNodes[5].style.opacity = '0.8';
e.parentNode.childNodes[5].style.fontWeight = '500';
});
}).observe(document, {
childList: true,
subtree: true
});
@tobimori
Copy link
Author

tobimori commented Jun 3, 2020

BetterLinguistColors

🌈 Makes GitHub language tags funky! 🌈

Click on Raw to install!


follow @tobimori on Twitter


πŸ’– Preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment