Skip to content

Instantly share code, notes, and snippets.

@alhazmy13
Forked from MoOx/index.js
Created February 13, 2019 08:41
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 alhazmy13/8c642a68f522cfa57ad4540a6000a05a to your computer and use it in GitHub Desktop.
Save alhazmy13/8c642a68f522cfa57ad4540a6000a05a to your computer and use it in GitHub Desktop.
Export/import github labels
// go on you labels pages
// eg https://github.com/cssnext/cssnext/labels
// paste this script in your console
// copy the output and now you can import it using https://github.com/popomore/github-labels !
var labels = [];
[].slice.call(document.querySelectorAll(".label-link"))
.forEach(function(element) {
labels.push({
name: element.textContent.trim(),
// using style.backgroundColor might returns "rgb(...)"
color: element.getAttribute("style")
.replace("background-color:", "")
.replace(/color:.*/,"")
.trim()
// github wants hex code only without # or ;
.replace(/^#/, "")
.replace(/;$/, "")
.trim(),
})
})
console.log(JSON.stringify(labels, null, 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment