Skip to content

Instantly share code, notes, and snippets.

@matt-dray
Last active June 20, 2024 09:23
Show Gist options
  • Save matt-dray/cda4a3facb6b1ca848a8ddbcc885a669 to your computer and use it in GitHub Desktop.
Save matt-dray/cda4a3facb6b1ca848a8ddbcc885a669 to your computer and use it in GitHub Desktop.
Make a shields.io README badge that links to a Shiny app, using the {badgr} package in R
# Make a README badge for your R Shiny repo
# Matt Dray, March 2021
# {badgr} blog post: https://www.rostrum.blog/2020/05/08/readme-badge/
# Shiny badge blog post: https://www.rostrum.blog/2021/03/23/shiny-badge/
# {badgr} is available from GitHub via {remotes}
install.packages("remotes") # if not already installed
remotes::install_github("matt-dray/badgr") # install {badgr}
# Generate badge URL and wrap in Markdown link
badgr::get_badge(
# Badge label
label = "Shiny", # left-side text
label_color = "white", # left-side colour
# Badge message
message = "shinyapps.io", # right-side text
color = "447099", # right-side colour, hex (no hashmark)
# Logo
logo_simple = "Posit", # named icon from simpleicons.org
logo_color = "447099", # could also used named colours for colours
# Markdown link
md_link = "https://mattdray.shinyapps.io/randoflag/", # clickable link URL
# Convenience arguments
browser_preview = TRUE, # preview badge in your browser
to_clipboard = TRUE # copies markdown to paste into readme
)
# Paste into your README, or any other (R) Markdown docs
@englianhu
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment