diff --git a/DESCRIPTION b/DESCRIPTION index 53e2724..be93a90 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -6,7 +6,8 @@ Authors@R: c( person("Mitchell", "O'Hara-Wild", email = "mail@mitchelloharawild.com", role = c("aut", "cre")), person("Earo", "Wang", role = "ctb"), person("Timothy", "Hyndman", role = "ctb"), - person("Matthew T. Warkentin", role = "ctb") + person("Matthew T. Warkentin", role = "ctb"), + person("Tom", "Jemmett", email = "thomas.jemmett@nhs.net", role = "ctb", comment = c(ORCID="0000-0002-6943-2990")), ) Description: Easily embed SVG icons into R Markdown documents or shiny apps. A collection of popular icon sets are supported by the package, including Font Awesome, Academicons and Ionicons. Depends: @@ -34,5 +35,5 @@ VignetteBuilder: knitr License: GPL-3 Encoding: UTF-8 LazyData: true -RoxygenNote: 7.1.1 +RoxygenNote: 7.2.3 Roxygen: list(markdown = TRUE, roclets=c('rd', 'collate', 'namespace')) diff --git a/NAMESPACE b/NAMESPACE index 4c809fa..d972642 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -15,6 +15,7 @@ export(download_bioicons) export(download_feather_icons) export(download_fontawesome) export(download_google_material) +export(download_health_icons) export(download_ionicons) export(download_octicons) export(download_simple_icons) @@ -22,6 +23,7 @@ export(fa) export(feather_icons) export(fontawesome) export(google_material) +export(health_icons) export(icon_find) export(icon_installed) export(icon_save) diff --git a/R/health_icons.R b/R/health_icons.R new file mode 100644 index 0000000..44aadf7 --- /dev/null +++ b/R/health_icons.R @@ -0,0 +1,45 @@ + +#' @rdname health_icons +#' @export +download_health_icons <- function(){ + url <- "https://healthicons.org/icons.zip" + + meta <- jsonlite::read_json( + "https://raw.githubusercontent.com/resolvetosavelives/healthicons/main/package.json" + ) + + install_icon_zip( + "health_icons", url, function(dl_dir) file.path(dl_dir, "icons", "svg"), + meta = list( + name = "Health Icons", + version = meta$version, + licence = c("CC-0", "MIT") + ) + ) + + invisible(health_icons) +} + +#' Health icons +#' +#' @param name Name of the icon +#' @param category The icon's category, either "blood", "body", "conditions", +#' "devices", "diagnostics", "emotions", "family", "medications", "objects", +#' "people", "places", "shapes", "specialties", "symbols", "typography", or +#' "vehicles" +#' @param theme The style variant for the icon, requires v4.0.0 or greater. +#' Available themes vary by icon, but can be either "filled", "negative", +#' "outline". If NULL, it will default to the +#' first available variant in this order. +#' @rdname health_icons +#' @export +health_icons <- new_icon_set( + "health_icons", + function(name, category = NULL, theme = NULL){ + if(is.null(category)){ + icon_guess(name, "health_icons", pattern = theme) + } else { + icon_fn$get(c(theme, category, name)) + } + } +) diff --git a/man/health_icons.Rd b/man/health_icons.Rd new file mode 100644 index 0000000..1fb25ee --- /dev/null +++ b/man/health_icons.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/health_icons.R +\name{download_health_icons} +\alias{download_health_icons} +\alias{health_icons} +\title{Health icons} +\usage{ +download_health_icons() + +health_icons(name, category = NULL, theme = NULL) +} +\arguments{ +\item{name}{Name of the icon} + +\item{category}{The icon's category, either "blood", "body", "conditions", +"devices", "diagnostics", "emotions", "family", "medications", "objects", +"people", "places", "shapes", "specialties", "symbols", "typography", or +"vehicles"} + +\item{theme}{The style variant for the icon, requires v4.0.0 or greater. +Available themes vary by icon, but can be either "filled", "negative", +"outline". If NULL, it will default to the +first available variant in this order.} +} +\description{ +Health icons +} diff --git a/man/icons-package.Rd b/man/icons-package.Rd index f6ec182..ae8e039 100644 --- a/man/icons-package.Rd +++ b/man/icons-package.Rd @@ -6,7 +6,7 @@ \alias{icons-package} \title{icons: SVG Icons for R Documents and Apps} \description{ -\if{html}{\figure{logo.png}{options: align='right' alt='logo' width='120'}} +\if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} Easily embed SVG icons into R Markdown documents or shiny apps. A collection of popular icon sets are supported by the package, including Font Awesome, Academicons and Ionicons. }