Skip to contents

The work of each card function, such as stats_card(): checks its arguments, draws the card with card_svg() and writes it to file, as a PNG through rsvg or as the SVG code itself.

Usage

draw_card(kind, stats, file, theme, days, panels, title, width)

Arguments

kind

The card: "stats", "contributions", "activity", "visitors", "actions" or "code".

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.

days

Count the traffic and runs of the last days days, up to the last full day collected: the day before the collection, which GitHub was still counting.

panels

One to three charts: "views", "clones", "actions", "top_viewed", "top_cloned", "top_starred" and "languages", or those of the other cards. By default c("views", "clones", "top_viewed") with traffic, c("actions", "top_starred", "languages") without.

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.

Examples

rghcard:::draw_card("stats", example_stats(), tempfile(fileext = ".svg"), "dark", 30, NULL,
                    NULL, 900)