Skip to content

Instantly share code, notes, and snippets.

@cspags
Created February 5, 2015 18:21
Show Gist options
  • Save cspags/8bb50b0e3e976ea94c84 to your computer and use it in GitHub Desktop.
Save cspags/8bb50b0e3e976ea94c84 to your computer and use it in GitHub Desktop.
Add colors to JIRA component names on the Agile board
(function() {
var colors = {
"Web App": "#d9a3d5",
"Native": "#D84315",
"Android": "#81C784",
"Plugin": "#7986CB",
"Server": "#4FC3F7",
"iOS": "#F9A825",
"Admin": "#4DB6AC"
}
var items = $("span[data-tooltip^='Component'] span");
for(var i = 0; i < items.length; i++) {
var $item = $(items[i]);
var t = $item.text().split(",");
$item.text($.trim(t[0])).css( {"color": getComponentColor(t[0]), "display": "inline"} );
for(var j = 1; j < t.length; j++) {
var comma = $("<span>", { class: "ghx-extra-field-content", text: "," }).css( {"color": "#333", "display": "inline"} ).insertAfter($item);
$("<span>", { class: "ghx-extra-field-content", text: t[j] }).css( {"color": getComponentColor(t[j]), "display": "inline"} ).insertAfter(comma);
}
}
function getComponentColor(name) {
var c = "#333";
name = $.trim(name);
if(colors.hasOwnProperty(name)) {
c = colors[name];
}
return c;
}
}) ();
@DearTanker
Copy link

how to use this?

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