Skip to contents

Draws the card of kind: the title and the days its numbers cover, a row of key figures, up to three charts, and a note under them, as card_spec() says.

Usage

card_svg(kind, stats, 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.

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 SVG code, a character string.

Examples

svg <- rghcard:::card_svg("contributions", example_stats(), "dark", 30, NULL, NULL, 900)
cat(substr(svg, 1, 400))
#> <svg xmlns="http://www.w3.org/2000/svg" width="900" height="490" viewBox="0 0 900 490" role="img" aria-label="GitHub contributions of example-user" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif">
#> <title>GitHub contributions of example-user</title>
#> <desc>Contributions: 4.1K (since Mar 2019), Last 12 months: 1.2K (contributions), Commits: 2.5K