Package 'badgr'

Title: Create A shields.io Badge URL
Description: Build a URL for a custom shields.io badge to use in your project's README file or elsewhere.
Authors: Matt Dray [aut, cre]
Maintainer: Matt Dray <[email protected]>
License: MIT + file LICENSE
Version: 0.2
Built: 2024-11-09 04:22:20 UTC
Source: https://github.com/matt-dray/badgr

Help Index


Generate A Static shields.io Badge

Description

Build a URL string that generates a shields.io metadata badge. For convenience, this function allows you to embed the URL in Markdown with a link and copies this to the clipboard for use in a README or elsewhere.

Usage

get_badge(
  label = "shields.io",
  message = "badge",
  color = "ff0000",
  style = "flat",
  label_color = NULL,
  md_link = NULL,
  link_left = NULL,
  link_right = NULL,
  logo_simple = NULL,
  logo_color = NULL,
  logo_width = NULL,
  logo_path = NULL,
  ext_override = NULL,
  browser_preview = TRUE,
  include_md = TRUE,
  to_clipboard = TRUE
)

Arguments

label

Text string to display on the left side of the badge.

message

Text string to display on the right side of the badge.

color

The background color of the right side of the badge. Should be one of hex, RGB, RGBA, HSL, HSLA or a CSS named color.

style

One of "plastic", "flat", "for-the-badge" or "social". See examples on shields.io.

label_color

The background color of the left side of the badge. Should be one of hex, RGB, RGBA, HSL, HSLA or a CSS named color.

md_link

A URL string to be used in your badge's Markdown output. If used, clicking the rendered HTML badge output will take you to this site.

link_left

A URL string for the left side of the badge. (Included for completeness; you probably want md_link instead)

link_right

A URL string for the right side of the badge. (Included for completeness; you probably want md_link instead)

logo_simple

Text string that names a logo from simple-icons.org to be placed on the far left of the badge. (Use either a named logo with logo_simple or a custom logo with logo_path; not both.)

logo_color

A color for the logo specified by logo_simple.

logo_width

Horizontal spacing width around the logo.

logo_path

URL string for your custom logo image. (Use either a named logo with logo_simple or a custom logo with logo_path; not both.)

ext_override

Provide a file extension that overrides the one in logo_path. (For example, you could specify png or gif if you're using a favicon in ico format.) You're unlikely to need this argument.

browser_preview

Do you want to preview the badge in the browser? Requires an internet connection.

include_md

Do you want to prepare the URL with Markdown syntax (![]()) to allow for direct copying into a Markdown file? Otherwise you get the bare URL. Use md_link to add a link to the badge.

to_clipboard

Do you want the string to be copied to your clipboard so you can paste it elsewhere? Will overwrite your current clipboard items.

Value

A Markdown text string.

Examples

get_badge(
  label = "Label",
  message = "Message",
  color = "blue",
  browser_preview = FALSE,
  to_clipboard = FALSE
)

Generate A Static shields.io CRAN DOI Badge

Description

Build a URL string that generates a shields.io metadata badge to display your CRAN package's DOI. For convenience, this function allows you to embed the URL in Markdown with a link and copies this to the clipboard for use in a README or elsewhere.

Usage

get_cran_doi_badge(package_name, ...)

Arguments

package_name

Single character string. Must be a package named on CRAN.

...

Optional arguments passed to get_badge.

Value

A Markdown text string.

Examples

get_cran_doi_badge(
  package_name = "datapasta",
  browser_preview = FALSE,
  to_clipboard = FALSE
)