Title: | Fast and Simple Badge Generator |
---|---|
Description: | Bindings to 'badgen' <https://www.npmjs.com/package/badgen> to generate beautiful 'svg' badges in R without internet access. Images can be converted to 'png' using the 'rsvg' package as shown in examples. |
Authors: | Jeroen Ooms [aut, cre] |
Maintainer: | Jeroen Ooms <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.1 |
Built: | 2024-11-02 05:42:50 UTC |
Source: | https://github.com/jeroen/badgen |
Generate a badge in the form of an svg string. Svg files can embedded directly in websites or converted to png as shown in examples.
badgen( label, status = "v1.2.3", color = "green", labelColor = "555", style = "classic", scale = 1, svg_icon = NULL )
badgen( label, status = "v1.2.3", color = "green", labelColor = "555", style = "classic", scale = 1, svg_icon = NULL )
label |
text for left part of the badge |
status |
text for right part of the badge |
color |
background for status part |
labelColor |
background for label part |
style |
one of 'classic' or 'flat' |
scale |
resize badge, default size is 1 |
svg_icon |
iteral svg string with icon, see examples |
svg string with the badge
home <- setwd(tempdir()) svg <- badgen("yolo", "success!", style = 'flat') writeLines(svg, 'test.svg') browseURL('test.svg') # Convert svg to bitmap rsvg::rsvg_png('test.svg', 'test.png') # Add an svg icon to the badge rlogo <- readLines('https://www.r-project.org/logo/Rlogo.svg') svg2 <- badgen('mypkg', 'awesome', scale = 4, svg_icon = rlogo) writeLines(svg2, 'test2.svg') browseURL('test2.svg') # Cleanup Sys.sleep(1) unlink(c('test.svg', 'test.png', 'test2.svg')) setwd(home)
home <- setwd(tempdir()) svg <- badgen("yolo", "success!", style = 'flat') writeLines(svg, 'test.svg') browseURL('test.svg') # Convert svg to bitmap rsvg::rsvg_png('test.svg', 'test.png') # Add an svg icon to the badge rlogo <- readLines('https://www.r-project.org/logo/Rlogo.svg') svg2 <- badgen('mypkg', 'awesome', scale = 4, svg_icon = rlogo) writeLines(svg2, 'test2.svg') browseURL('test2.svg') # Cleanup Sys.sleep(1) unlink(c('test.svg', 'test.png', 'test2.svg')) setwd(home)