Skip to content

Instantly share code, notes, and snippets.

@MoOx
Last active June 8, 2025 14:14
Show Gist options
  • Save MoOx/93c2853fee760f42d97f to your computer and use it in GitHub Desktop.
Save MoOx/93c2853fee760f42d97f to your computer and use it in GitHub Desktop.

Revisions

  1. MoOx revised this gist May 6, 2015. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion index.js
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,15 @@ var labels = [];
    .forEach(function(element) {
    labels.push({
    name: element.textContent.trim(),
    color: element.getAttribute("style").replace("background-color:", "").replace(/color:.*/,"").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))
  2. MoOx revised this gist May 6, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion index.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // go on you labels pages
    // eg https://github.com/cssnext/cssnext/labels
    // paste this script in your console
    // copy the output and enjoy !
    // copy the output and now you can import it using https://github.com/popomore/github-labels !

    var labels = [];
    [].slice.call(document.querySelectorAll(".label-link"))
  3. MoOx created this gist May 6, 2015.
    14 changes: 14 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    // go on you labels pages
    // eg https://github.com/cssnext/cssnext/labels
    // paste this script in your console
    // copy the output and enjoy !

    var labels = [];
    [].slice.call(document.querySelectorAll(".label-link"))
    .forEach(function(element) {
    labels.push({
    name: element.textContent.trim(),
    color: element.getAttribute("style").replace("background-color:", "").replace(/color:.*/,"").trim(),
    })
    })
    console.log(JSON.stringify(labels, null, 2))