0.2.1 • Published 2 years ago

@luizppa/ng-github-contributions v0.2.1

Weekly downloads
-
License
GPL
Repository
github
Last release
2 years ago

Angular Github Contribuions

An angular component to reproduce the appearence and behaviour of the Github contributions board. So far, the component supports custom color themes and time span, but more options will be added in the future.

Overview

Default appearence Example image

Custom colors Example image

Custom time span Example image

Hiding labels Example image

Installation

To install from npm:

npm i --save @luizppa/ng-github-contributions

Import GithubContributionsModule into your app module:

import { GithubContributionsModule } from "@luizppa/ng-github-contributions";

//...

@NgModule({
  //...
  imports: [
    //...
    GithubContributionsModule,
  ],
  //...
});

Usage

Basic usage

<github-board
    [profile]="'luizppa'"
    [onCellClick]="onCellClickHandler"
    [options]="boardOptions">
</github-board>

Options

Optionally, you can specify an options object to configure the appearence fo the board. The available options are shown on the table bellow:

OptionTypeDefault valueDescription
cellSizenumber10Defines the size of each individual board cell in pixels.
weeksNumbernumber53Defines the time span shwon on the board in number of weeks.
colorPaletteGithubBoardColorPaletteDefines the color palette for the board cells.
labelsGithubBoardLabelOptionsDefines the properties of the labels indicating day and month around the board.

GithubColorPalette Type

Object that defines the color scheme to use on the board. The colors must be specified as strings in any HTML suported format (HEX, rgb, rgba...).

OptionTypeDefault valueDescription
nonestring#EBEDF0Defines the color for cells with no contributions.
lowstring#9BE9A8Defines the color for cells with 1 - 3 contributions.
mediumstring#40C463Defines the color for cells with 4 - 8 contributions.
highstring#30A14EDefines the color for cells with 9 - 10 contributions.
higherstring#216E39Defines the color for cells with more than 10 contributions.

GithubBoardLabelOptions Type

OptionTypeDefault valueDescription
showMonthbooleantrueDefines whether or not to show month labels.
showDaybooleantrueDefines whether or not to show day labels.
sizenumber9Defines the font size of the labels in pixels.