Skip to contents

Draws the contributions that collect_stats() collects, the numbers of the contribution graph of a GitHub profile, as a card: a row of key figures and up to three charts, as a PNG or an SVG file, in a dark or a light mode.

Usage

contributions_card(
  stats = "rghcard-data",
  file = "rghcard-contributions.png",
  theme = c("dark", "light"),
  panels = NULL,
  title = NULL,
  width = 900
)

Arguments

stats

The statistics: what collect_stats() or read_stats() return, or the folder of the history.

file

The card: a .png or an .svg file. NULL returns the SVG code instead.

theme

"dark" or "light": the colours of GitHub's dark or light mode.

panels

One to three charts: "contributions", "commit_languages" and "languages", or those of the other cards. By default c("contributions", "commit_languages", "languages").

title

The title, by default the user name.

width

Width of the card in pixels. A PNG has twice as many, to stay sharp on high-resolution screens.

Value

The file, invisibly, or the SVG code when file is NULL.

Details

The key figures are the contributions since the user joined GitHub and in the 12 full months before the collection, the commits, and the current and the longest streak of days with contributions. A streak still runs on the day of the collection when that day has no contribution yet. By default the charts are:

  • "contributions": the contributions per month in the 12 full months before the collection, with the busiest month labelled.

  • "commit_languages": the commits per main language of their repositories, as a ring with a legend: five languages at most, and the rest together as "Other", each in the colour that GitHub gives the language.

  • "languages": the repositories per main language, as the same kind of ring.

Contributions are what the contribution graph of a GitHub profile counts, in UTC days: commits, issues, pull requests, reviews, discussions, and new and forked repositories, with the private ones as bare numbers when the profile shows them. The commits and their languages are those in public repositories, unless collect_stats() was asked for the private ones.

See also

view_card() shows the card in the Viewer or the Plots pane, stats_card() draws the repositories and their traffic, activity_card() the kinds of contributions, and use_rghcard_action() refreshes the cards on your profile.

Examples

contributions_card(example_stats(), tempfile(fileext = ".png"))
card <- contributions_card(example_stats(), tempfile(fileext = ".svg"), theme = "light")
view_card(card, "plots")