Skip to content

x3388638/github-calendar-graph

Repository files navigation

github-calendar-graph npm version MIT Licence Open Source Love

Get the GitHub contributon calendar graph.
calendar-graph

Demo

Append the calendar graph as you see at GitHub to everywhere you want.
demo

Install

$ npm install github-calendar-graph --save

Usage

const CalendarGraph = require("github-calendar-graph");

// get contribution graph
CalendarGraph.fetch("GITHUB ACCOUNT").then(data => {
  console.log(data); // => string of HTML DOM
});

// get contribution count
CalendarGraph.fetch("GITHUB ACCOUNT", true).then(data => {
  console.log(data); // => { 'DATE': 'CONTRIBUTION COUNT' }
  /*
    {
      '2018-07-01': 3,
      '2018-07-02': 1,
      '2018-07-03': 9,
      ...
    }
  */
});

// get contribution data including count and color
CalendarGraph.fetch("GITHUB ACCOUNT", true, true).then(data => {
  console.log(data); // => { 'DATE': { count: 'CONTRIBUTION COUNT', color: 'COLOR FILLED' } }
  /*
    {
      '2018-07-01': {
        count: 3,
        color: '#196127'
      },
      '2018-07-02': {
        count: 0,
        color: '#ebedf0'
      },
      ...
    }
  */
});