R/icons.R

Defines functions shiny_icons browse_fontawesome

Documented in browse_fontawesome shiny_icons

#' Open fontawesome icons webpage
#'
#' @export
browse_fontawesome <- function() {
  browseURL("https://fontawesome.com/v5.3.1/icons?d=gallery&m=free")
}


#' Shiny Icons
#'
#' @return character vector of shiny package icons
#' @export
#' @importFrom utils tail
shiny_icons <- function() {

  file.path('www', 'shared', 'fontawesome', 'css', 'all.min.css') %>%
    system.file(package = 'shiny') %>%
    readLines(warn = FALSE) %>% utils::tail(1L) %>%
    strsplit('.', fixed = TRUE) %>% unlist %>%
    gsub(':before\\{content:".+"\\}', '', . ) %>%
    grep('fa-', ., fixed = TRUE, value = TRUE) %>%
    grep('[{,]', ., value = TRUE, invert = TRUE) %>%
    gsub('^fa-', '', .)

}
jimbrig/jimstools documentation built on Sept. 12, 2022, 12:08 p.m.