Draws the code of the repositories of a user, from what collect_stats()
collects: its size in each language, the largest repositories, the stars over the last 12
months, and the forks and watchers, as a card for a GitHub profile, a PNG or an SVG file, in a
dark or a light mode.
Usage
code_card(
stats = "rghcard-data",
file = "rghcard-code.png",
theme = c("dark", "light"),
panels = NULL,
title = NULL,
width = 900
)Arguments
- stats
The statistics: what
collect_stats()orread_stats()return, or the folder of the history.- file
The card: a
.pngor an.svgfile.NULLreturns the SVG code instead.- theme
"dark"or"light": the colours of GitHub's dark or light mode.- panels
One to three charts:
"code_languages","stars_history","largest","top_forked"and"top_watched", or those of the other cards. By defaultc("code_languages", "stars_history", "largest").- 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.
Details
The key figures are the bytes of code in the repositories, the number of languages, the stars, with those given in the last 12 months, the forks and the watchers. GitHub counts the bytes of each language as in the language bar of a repository: without documentation, vendored and generated files. By default the charts are:
"code_languages": the bytes of code per language, 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. The rings of the other cards count repositories or commits instead."stars_history": the stars at the end of each of the 12 full months before the collection, as columns. A star taken back is gone from every month: GitHub keeps only those still given."largest": the five repositories with the most code.
"top_forked" and "top_watched", the five repositories with the most forks or watchers,
can take the place of one.
See also
view_card() shows the card in the Viewer or the Plots pane, stats_card() draws the
stars among the other statistics, and use_rghcard_action() refreshes the cards on your
profile.
Examples
card <- code_card(example_stats(), tempfile(fileext = ".svg"))
view_card(card, "plots")
code_card(example_stats(), tempfile(fileext = ".png"), theme = "light",
panels = c("code_languages", "top_forked", "top_watched"))