Skip to content

Instantly share code, notes, and snippets.

@jh34ghu43gu
Created January 31, 2023 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jh34ghu43gu/02a946da0650b901d33fe084b7b1dad1 to your computer and use it in GitHub Desktop.
Save jh34ghu43gu/02a946da0650b901d33fe084b7b1dad1 to your computer and use it in GitHub Desktop.
Old backpack.tf custom tag color greasemonkey script
// ==UserScript==
// @name backpack custom tag colors
// @version 1
// @grant none
// @include https://backpack.tf/profiles/76561198107192699
// @run-at document-end
// ==/UserScript==
//Rainbow + white/black
var colors = ["ff0000", "ffa500", "ffff00", "008000", "0000ff", "800080", "ffc0cb", "000000", "ffffff", "2F4F4F", "7D4071", "141414", "BCDDB3", "2D2D24", "7E7E7E", "E6E6E6", "E7B53B", "D8BED8", "E9967A", "808000", "729E42", "CF7336", "A57545", "51384A", "C5AF91", "FF69B4", "694D3A", "32CD32", "F0E68C", "7C6C57", "424F3B", "B8383B", "5885A2"];
var colorNames = ["Red", "Orange", "Yellow", "Green", "Blue", "Purple", "Pink", "Black", "White", "A Color Similar to Slate", "A Deep Commitment to Purple", "A Distinctive Lack of Hue", "A Mann's Mint", "After Eight", "Aged Moustache Grey", "An Extraordinary Abundance of Tinge", "Australium Gold", "Color No. 216-190-216", "Dark Salmon Injustice", "Drably Olive", "Indubitably Green", "Mann Co. Orange", "Muskelmannbraun", "Noble Hatter's Violet", "Peculiarly Drab Tincture", "Pink as Hell", "Radigan Conagher Brown", "The Bitter Taste of Defeat and Lime", "The Color of a Gentlemann's Business Pants", "Ye Olde Rustic Colour", "Zepheniah's Greed", "Team Spirit RED", "Team Spirit BLU"]
var observer = new MutationObserver(function(mutations) {
for(var i=0; i<mutations.length; i++) {
var mutationAddedNodes = mutations[i].addedNodes;
for(var j=0; j<mutationAddedNodes.length; j++) {
var parentNode = mutationAddedNodes[j];
if(parentNode.className === "modal-backdrop fade in") {
var colorPanel = document.getElementById("item-tag-color-pane");
var c = 0;
colors.forEach(color => {
var node = document.createElement("a");
node.setAttribute("class", "btn btn-default tagging-modal-color active");
node.setAttribute("style", "background-color:#" + color + ";width:24px;height:24px;");
node.setAttribute("data-color", "#" + color);
node.setAttribute("title", colorNames[c]);
colorPanel.appendChild(node);
c++;
});
}
}
}
});
observer.observe(document, {childList: true, subtree: true});
@jh34ghu43gu
Copy link
Author

Should note you're going to need to change the @include to your own profile if you want to use it.

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